-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.js
More file actions
22 lines (20 loc) · 1.05 KB
/
Copy pathstring.js
File metadata and controls
22 lines (20 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
let str="Danish "
str=str.concat("Bhai")//For concatenation.
console.log(str)
console.log(str.length)
console.log(str.toLowerCase())
console.log(str.toUpperCase())
// console.log(str[0])//It will print the first letter of the string.
// console.log(str.indexOf('Bhai'))//It will print the lenght of Bhai.
// console.log(str.lastIndexOf('a'))//It will print the last occurence of a .
// console.log(str.charAt('2'))//It will print the third character of the string.
// console.log(str.endsWith('Bhai'))//If string will ends with bhai then it will returns true.
// console.log(str.includes('B'))//If the string includes B then it will returns true.
// console.log(str.substring('0,10'))//From 1st to 1s1th character it will print .
// console.log(str.split('B'))//It will split this character and returns its character lenght.
// console.log(str.replace('Bhai', 'Pro'))//It will replace Bhai with pro.
let namw="Danish"
let a="pro"
let b="Sahi"
let c=`Bhai ${namw} Kya hall hai`;//In this curly brackets we can write variable by using ` sign in the start.
console.log(c)