Skip to content

Commit 26f1be7

Browse files
committed
string and number
1 parent 62378ae commit 26f1be7

2 files changed

Lines changed: 68 additions & 0 deletions

File tree

01_basics/number_maths.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
const score = 400
2+
//console.log(score);
3+
4+
const balance = new Number(100)
5+
//console.log(balance);
6+
7+
//console.log(balance.toString().length);
8+
//console.log(balance.toFixed(3));
9+
10+
const otherNum= 123.8966
11+
//console.log(otherNum.toPrecision(3));
12+
13+
const hundreds= 1000000
14+
//console.log(hundreds.toLocaleString('en-IN'));
15+
16+
//+++++++++++++++++++ Maths ++++++++++++++++++++
17+
18+
// console.log(Math);
19+
// console.log(Math.abs(-4));
20+
// console.log(Math.round(4.6));
21+
// console.log(Math.ceil(4.2));
22+
// console.log(Math.floor(4.9));
23+
// console.log(Math.min(4, 3, 6, 8));
24+
// console.log(Math.max(4, 3, 6, 8));
25+
26+
console.log(Math.random());
27+
console.log((Math.random()*10) + 1);
28+
console.log(Math.floor(Math.random()*10) + 1);
29+
30+
const min = 10
31+
const max = 20
32+
33+
console.log(Math.floor(Math.random() * (max - min + 1)) + min)

01_basics/strings.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const name = "hitesh"
2+
const repoCount = 50
3+
4+
// console.log(name + repoCount + " Value");
5+
6+
console.log(`Hello my name is ${name} and my repo count is ${repoCount}`);
7+
8+
const gameName = new String('hitesh-hc-com')
9+
10+
// console.log(gameName[0]);
11+
// console.log(gameName.__proto__);
12+
13+
14+
// console.log(gameName.length);
15+
// console.log(gameName.toUpperCase());
16+
console.log(gameName.charAt(2));
17+
console.log(gameName.indexOf('t'));
18+
19+
const newString = gameName.substring(0, 4)
20+
console.log(newString);
21+
22+
const anotherString = gameName.slice(-8, 4)
23+
console.log(anotherString);
24+
25+
const newStringOne = " hitesh "
26+
console.log(newStringOne);
27+
console.log(newStringOne.trim());
28+
29+
const url = "https://hitesh.com/hitesh%20choudhary"
30+
31+
console.log(url.replace('%20', '-'))
32+
33+
console.log(url.includes('sundar'))
34+
35+
console.log(gameName.split('-'));

0 commit comments

Comments
 (0)