Learn to Code via Tutorials on Repl.it!

← Back to all posts
Learning JS the easy way
h
techstuffstuff (4)

Welcome to this new tutorial on JavaScript which should be updated every day!

Things added:

  • Printing, variables and arrays

Printing in the console:

In this tutorial we will learn to say something in the console, use variables, and arrays.

when you do the

console.log();

function is creates some text in your console which is located inside the inspector

we will use the about:blank page in your browser to write code,

in this short clip I show you how to use the

console.log()

function!

(click to zoom in)

you need to use quotation marks when writing text!

Variables and Arrays:

variables are a type of element that holds data, if you are doing algebra in math you will have used a variable before.

to create a variable you must do

VAR <variable name> = <variable value>;

Most lines of code will end with a ;

As you can see we declared a name and a value for our variable

Variable types:
booleans,
strings
or
integers

our the main types

  • Booleans: have true or false as the value
  • Strings: have "<text>" as the value (the <text> part varies)
  • Integers or ints: numbers without any quotation marks!

You can use variables in printing by doing this:

var str = "Hello, World!";
console.log(str);

In that code we declared a new variable<string> and set its value to Hello, World!
then we printed the variable!

This clip will show you how to start writing your code!

Commentshotnewtop
RohilPatel (1459)

thats a promise you gottta keep!! good luck!

techstuffstuff (4)

@RohilPatel ill try im working on a JS game engine