-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfirst.js
More file actions
69 lines (54 loc) · 1.86 KB
/
first.js
File metadata and controls
69 lines (54 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
"use strict";
let lol=55; //let can be only need to declare one time
console.log(typeof lol,lol); //typeof operator
const pi=3.14;
//to display the first element of the string
let myname="vIkAsH ";
console.log("the 2nd enelemnt to the given name is:",myname[1]) //****see name LOL*****/
// to print the laste index of the element
console.log(myname[myname.length-1]);
console.log(myname.trim(),myname.toUpperCase(),myname.toLowerCase());
console.log(myname.slice(0,4));
//*****to convert the type of variable******
let lol1="150"
console.log(typeof +lol)
//string to number
let lol2=123
lol2=String(lol2)
console.log(typeof lol2);
//string concat
let newname=lol1+lol2;
console.log(newname);
//Template String `i like your cut G ${lol}`
console.log(`my name is ${myname} and my age is ${lol}`);
//Big int
let bigNumber=BigInt(232424325436464467576);
//or
bigNumber=2335353453535354535n;
console.log(bigNumber); console.log(Number.MAX_SAFE_INTEGER); //max no. in int
// ****== will only chech value and === will check bot value and datatype****
// ****same with != and !== ****
//******Truthy values*******
// false "" 0 numm undefined
let firstname="";
if(firstname){console.log("it will run if there is truthy items")};
let age=15;
if(age>20?console.log("no more teen"):console.log("lol u kidd go home"));
//*********Taking Iput form the USER************/
let inputName=prompt("Enter your IGN here");
console.log(+inputName,"AGE is here") //+ will conver the input into number
//*********WHILE and FOR Loop and DO WHILE**********/
let ticks=0;
while(ticks<10){ //will only print till 9 as ticks<10
console.log(ticks);
ticks++
}
for(let i=0;i<10;i++){
console.log(i);
}
do{
let ticks=0; //crash pc by typing ***let ticks=0; and commentput other lopps
console.log(ticks);
ticks++;
}
while(ticks<10);