-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.js
33 lines (24 loc) · 893 Bytes
/
search.js
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
29
30
31
32
33
const lyrics = "Tumi amar amoni akjon, jake ak jonome valobeshe vorbe na a mon";
// const searchString = lyrics.includes('jake');
// console.log(searchString);
const searchString = 'Valobeshe';
// const doesExist = lyrics.includes(searchString);
const lyricsLowerCase = lyrics.toLowerCase();
const searchStringLower = searchString.toLowerCase();
const doesExist = lyricsLowerCase.includes(searchStringLower);
console.log(doesExist);
const doesExistOneLine = lyrics.toLowerCase().includes(searchString.toLowerCase());
console.log(doesExistOneLine);
// -----------index of-------
console.log(lyrics.indexOf('jonome'));
console.log(lyrics.indexOf('Tumi'));
if (lyrics.indexOf('amoni') !== -1){
console.log('exists inside the stiing')
}
else{
console.log("cann't find it");
}
// endswith
const fileName = 'mybiodata.pdf';
const otherFile = 'mypic.png';
fileName.endsWith ('.pdf');