Learn to Code via Tutorials on Repl.it!

← Back to all posts
✨✨Basic JavaScript Tutorial✨✨
KfirHarif (0)

JavaScript Tutorial!

Hi person who is reading this tutorial! Thank you for clicking on this boring fun tutorial! As you have seen (if you had any common sense) this is a JavaScript tutorial and I'm gonna teach you some of the basics of JavaScript!

Comments

Ok! So, to make a comment all you have to do is write two slashes (//) and put what you want to write in your comment after that!
Example:

// This is a comment!
// This is another comment!

For multi-line comments, you have to put a slash and a star to start the comment and to close it you have to put a star and then the slash.
Example:

/*
Dear Mr. Guy-Who-Made-This-Tutorial,

I would like to thank you for showing me how to comment in JavaScript and I would also want to thank you for making this fun!

From,
   Mr. Guy-Who-Read-This-Tutorial 😀
*/

Comments don't have an output because they are just text in your code.

Console.log()

Ok, so if you know some Python, then you might know that to write something in the console you have to write print("what you want to write"). But in JavaScript you have to write console.log("what you want to write").
Example:

console.log("Hello World!");

Output:

Hello World!

You can also put in numbers in a console.log() sentence.
Example:

console.log(92929092);

Output:

92929092

Every JavaScript line has to end in a semicolon (;).

Strings

So strings are just what they sound like; strings of characters! Strings always have to be enclosed in either double quotes ("") or single quotes ('') but they can't be mixed like this: 'this is a string" or like this: "this is a string'. This is an example of the right way:

"this is a string"
'this is also a string'

I wanted to go over strings because they are very important when you want to write something or sometimes give a value to something.

Variables

Some of the