Javascript is a lightweight interpreted programming language
It is used to create dynamic and interative elements in web application
It is open and cross platform
Javascript is an interpreted programming language with object-oriented capabilities
It is a single threaded programming language that we can use for client-side or server-
side development
Download [Link] And install It
To verify installation open command prompt and type node –version, if an error is not
prompted then node is successfully installed
To Run Javascript
Open vscode
Create a js file eg: [Link]
To print something on console
o [Link](“<message to print>”)
o eg: [Link](“Hello World”)
Click on Terminal on VScode then click on New Terminal
On the terminal to run the file type
o node <filename>
o eg: node [Link]
o The file will be executed
Variable Declaration
To declare a variable let keyword is used
o let <variable name>
eg: let a = 10
characters and numbers are allowed in a variable name
o only the name should not begin with number
$ symbol and _ is also allowed
To declare a constant variable
o const <variable name>
eg: const pi = 3.14
Data types
There are two types of datatypes
o Primitive
o Object
In Primitive
o Number
o String
o Boolean
o Null
o Undefined
To find the type of a variable
o typeof keyword is used
typeof <variable name>
eg: typeof myname
To convert a number to string
o String function is used
String(valuetobeconverted)
eg: string(5)
Convert string to number
o Number function is used
Number(stringtobeconvereted)
eg: Number(“12345”)
To extract number alone from a string
o parseInt function is used
parseInt(<string>)
eg: parseInt(“123 Hello”)
Relational Operator
== compares only value
=== compares value and data type
Ternary Operator
To execute a statement based on a condition ternary operator is used
o <condition> ? <true value> : <false value>
eg: a>b ? “a is greater” : “b is greater”
Using Template Literal
[Link](`The first variable is ${first} and second variable is ${second}`)