This website collects cookies to deliver better user experience
Basic JavaScript - Comments, Data Types, Variables
Basic JavaScript - Comments, Data Types, Variables
Topics:
Comments
Data Types
Variables
Comments
Comments are lines of code that JavaScript will ignore. Comments are used to leave some notes to your future self and to other people who will later open your code.
There are two ways to type comments in JS.
// is used for inline comment.
/**/ is used for multi line comment.
/** */ is used for documentation
Data Types
Data is anything that is meaningful to the computer. Like we have videos, texts, songs, etc. In general we can say a text a data type, we can't store a video in a text file or a text in a video file, they are different data types.
JavaScript provides eight different data types which are undefined, null, boolean, string, symbol, bigint, number, and object.
number - 1,2,3...
strings - "abcd.."
boolean - true, false
etc
Variables
Variables are similar to the x and y variables you use in mathematics but in computer we use variable to point to some value, means they are just a simple name referring at some value.
In JavaScript we can define variable in different ways.
This is just a basic intro from my side, you can learn more from: