-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind.html
More file actions
18 lines (18 loc) · 887 Bytes
/
find.html
File metadata and controls
18 lines (18 loc) · 887 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<script>
(function(){
let str = 'JavaScript in easy steps'
console.log('"Script" Search: ' + str.search('Script'))
console.log('"script" Search: ' + str.search('script'))
console.log('\n"Script" Match: ' + str.match('Script'))
console.log('"script" Match: ' + str.match('script'))
console.log('\IndexOF "s": ' + str.indexOf('s'))
console.log('indexOf "m": ' + str.indexOf('m'))
console.log('\nlastIndexOf "s": ' + str.lastIndexOf('s'))
console.log('lastIndexOf "m": ' + str.lastIndexOf('m'))
console.log('\ncharAt 0: ' + str.charAt( 0 ))
console.log('charCodeAt 0: ' + str.charCodeAt( 0 ))
console.log('fromCharCode: ' + String.fromCharCode( 74, 97, 118, 97 ))
console.log('\nOriginal: ' + str)
console.log('Replaced: ' + str.replace('easy', 'simple'))
})()
</script>