Learn Javacript Day 1 of 30 Days Learning Javascript Series

damm
4 min readJul 8, 2023

--

Javascript syntax

Hello everyone my name is Adam Febrian Aditama, people usually call me Adam, I’m from Indonesia. Recently i started to learning web development and I’ve been learning HTML and CSS, and today was a good day to learn Javascript. A liitle more i use this repository to help me learn javascript. I think that’s enough let’s get started.

Usually to learn a programming language we have to learn it from the fundamental so, I have to do that.

First thing that I learn from this repository was how to use the browser developer tools and to open it you can simply press F12 or use keybinds ctrl + shift + i (windows/linux) and Iuse linux. if you don’t know what it is, there I have an example.

a screenshoot of browser developer tools

I think that every browser will have different interfaces for their browser developer tools, I use Firefox for my main browser btw. Okay in there you will see different tabs such as Inspector, Console, Network, Memory, Application etc. But to learn JS we just have to focus on Console tabs. In here we can type JS syntax and the browser will show the output in here too. For example if we type

console.log("Hello World!");

and then press enter the console will give output like this

an console.log() function that written in console browser developer tools

Not only console.log function that can be executed by this tools but every JS function can be written here. Then I learn that we can perform aritmethic operation here too. For example I type this

console.log(1 + 1);

and then the console will give output like this

It’s amazing that not only we can perform addition operation but, we can perform like subtraction, multiplication, division, modulus and exponentiation like this

console.log(1 + 1); // return 2
console.log(1 - 1); // return 0
console.log(1 * 1); // return 1
console.log(1 / 1); // return 1
console.log(1 % 1); // return 0
console.log(1 ** 1); // return 1

The output

Next I learn variable and data type in JS. In JS we use keyword var, let and const (const stand for constant)to make variable and use equals sign to assign a value to the variable for example

var myNum = 1;
let myString = "Hello Javacript";
const MONTH = "December";

In this repository it says that we have to use let keyword to make a variable because the var has a scope issue that we will cover that topic in other article because I’m haven’t learn that too.

The difference between let and const

We use let when the value of the variable can/will be change in the program, and const will be used when the value of that variable can’t be changed. For example we will use let to make any usual variable like this

let firstName = "John";
let LastName = "Doe";

and the const will be used if the value can’t be changed such as month, days math constant like PI etc.

const PI = 3.14;
const MONTH = "January";

it’s just a convention to write any JS const using uppercase because it will remind that this variable is a constant.

Okay the last thing that i learn in day 1 was data types, in JS there is 5 primitive types, it was string, number, boolean, null and undefined and to check its value we can use keyword typeof.

// we declare the variable first
let myNum = 10;
let myStr = "Adam";
let myBool = true;
let myNull = null;
let myUndefined = undefined;

// and then check its value using typeof keyword
console.log(typeof myNum, typeof myStr, typeof myBool, typeof myNull, typeof myUndefined);

then if we run this code it will return value like this

I would highly recommend to write JS code using your favorite text editor for me I use Visual Studio Code for my main text editor. You can choose your fav text editor.

I think that’s it for today, I write this article just for documenting what i’ve been learned from the repository, not to make tutorial. So if you feel like having any confusing please comment down below, and I will answer your question asap.

Anyway thank you readers, for reading my article this down Goodbye~

--

--