-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringbasics.js
More file actions
21 lines (20 loc) · 859 Bytes
/
stringbasics.js
File metadata and controls
21 lines (20 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const name="Ishan"
const repoCount=5;
console.log(name+repoCount+"Value");//this method is not preferred for concatenating strings
console.log(`Hello my name is ${name} and my repo count is ${repoCount}`)
const gameName=new String(`Ishan`) //first and fifth line are the two methods to declare a string,
console.log(gameName[0])
console.log(gameName.__proto__)
console.log(gameName.length)
console.log(gameName.toUpperCase);
console.log(gameName.charAt(2));
console.log(gameName.indexOf('n'));//the character at index 4 will not be taken
console.log(gameName.substring(-8,4));
console.log(gameName.slice(-8,3))
const newStringOne=" ishan "
console.log(newStringOne);
console.log(newStringOne.trim());
const url="https://hitesh.com/hitesh%20choudhary"
console.log(url.replace("%20","-"));
console.log(url.includes('hitesh'));
console.log(url.split('h'));