JS1 ClassNotes
JS1 ClassNotes
lege
Col
a
Input (code) Computer Output
Apn
use console in any browser or just open one of your projects and use that
the code is not permanent, we can use the up & down arrow to bring back old code
Setting up VS Code
It is a free & popular code editor by Microsoft
lege
Col
pna
A we'll use the chrome developer tools console to write our code
but not for long terms as afterwards we will start to use js file
like we used for css
Our 1st JS Code
Console.log is used to log (print) a message to the console
lege
Col
console.log(“Apna College”);
pna
A
Variables in JS
Variables are containers for data
lege
Col
na
radius
14
Ap
memory
Variable Rules
Variable names are case sensitive; “a” & “A” is different.
lege
l
Only letters, digits, underscore( _ ) and $ is allowed. (not even space)
a Co
Only a letter, underscore( _ ) or $ should be 1st character.
Apn
Reserved words cannot be variable names.
let, const & var
var : Variable can be re-declared & updated. A global scope variable.
lege
ol
let : Variable cannot be re-declared but can be updated. A block scope variable.
C
pna
A
const : Variable cannot be re-declared or updated. A block scope variable.
Data Types in JS
Primitive Types : Number, String, Boolean, Undefined, Null, BigInt, Symbol
lege
Col
pna
A
ge
String
ol le
a C
Number
Follow
Apn
Boolean
Let‘s Practice
Qs1. Create a const object called “product” to store information shown in the picture.
lege
Col
pna
A
Let‘s Practice
Qs2. Create a const object called “profile” to store information shown in the picture.
lege
Col
pna
A