-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.js
More file actions
34 lines (25 loc) · 983 Bytes
/
strings.js
File metadata and controls
34 lines (25 loc) · 983 Bytes
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
//how to write a string
// let name='mehak'
// let subject='javascript'
// console.log(`hi my name is ${name} and I love ${subject}`)// use this symbol `
//methods simple string
// let lastname= new String ('kamran')
// console.log(lastname.toUpperCase())
// console.log(lastname.length)
// console.log(lastname.charAt(2))
// console.log(lastname.indexOf('m'))
// console.log(lastname.substring(0,3))// substring cannot take any neg value
// console.log(lastname.slice(-5,4))//slice can take neg value
//trim
// let fname=' Siddiqui '
// console.log(fname)
// console.log(fname.trim())
//replace
let url='[email protected]'
console.log(url.replace('56','52'))
//include
// const market_list=['apple','dahi','pen']
// console.log(typeof(market_list))// array type is object and these method is applied on strings only , wheather array is string array
// console.log(market_list.includes('chips'))
console.log(url.includes('get'))
console.log(url.split('@'))