Code: Js by Monochrome-Fox-41

Code: Js

Wanna learn Javascript?

Well!

You've come to the right place!

Here, I'll go through some Javascript snippets to help with learning Javascript code.
There will be two Sections, one is where it'll be in chrome's V8 engine!
The other is Node.js
Note: Don't read through all of this if you're not a beginner.
Maybe later on if you are minor or experienced. There will be tutorials on that but for now these are
beginner level contents.

Chrome V8 Engine & Nodejs

So! here we are now I know you may be scared but don't worry it'll be fine!

Simple equations
So yes there's equations in Javascript.
5 + 5 or 5+5 will = 10

Hello world

I've seen allot of programmers who teach tutorials go with the following:

console.log("Hello world")
Hello world

And I think it's a poor example of showing code in any shape or form.
But today, I'll show you something better!
Functions!

Just type this:

function Hello (name) {
  return "Hello "+name
}

Now some people called "Experienced" or "Experts". Will try and correct me on the above snippet.
Literal note: Javascript's ASI
It is optionary for people to either use semi-colons or no semi-colons at all.
If anyone tells you that you NEED to put semi-colons, then they are the biggest liars.
It is only your optionary choice

Anyways after that, Now you need to call it!

"How do I call it?"

Well it's simple in either Chrome's dev tools or Nodejss' CLI (command line interface)
You can type: Hello(INSERT_NAME_HERE)
now obviously you can put in a string or a variable...but what are they?

A string is a(n) array of single characters including spaces.
That's how I think it got it's name
Because it's a string of characters!
ba dum chh

A variable is basically a special bookmark that,
in the computers magical memory, means something.
like for example:

var User = "John Cena!" // *music plays in the background*
// Oh by the way, these are single-line-comments.
// These are ALWAYS ignored by the JS interpreter
// And apparently these can have special keywords!
// like: HACK: or NOTE:
/*
There's also multi-line-comments.
And these have keywords too!
HACK: and NOTE:
*/
/**
And these are special comments.. since..... I was never shown these:
{Something} , <Something> , @Something
*/

I know I'm cringy don't offend meh
m**8** ;m;

I'm kidding. Anyways, if you want to reference the variable,
type in the Name, ie: User
or:

Hello(User)
// Outputs: "Hello John Cena!"

Now you may be wondering "How does that work?",
This is done by String concatination. In theroy,

In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball". In some but not all formalisations of concatenation theory, also called string theory, string concatenation is a primitive notion. - Wikipedia

Basically, it combines them. And since they're arrays AKA: strings,
it just mashes the two strings together end-to-end.

That is all for now hope you enjoyed this little tutorial,
This was also made in Markdown.

Code: Js

Monochrome-Fox-41

22 January 2017 at 11:20:25 MST

A small javascript tutorial. Sorry if it goes everywhere ;3;

Submission Information

Views:
534
Comments:
0
Favorites:
0
Rating:
General
Category:
Literary / Other

Tags Modify History

Edit Tags