-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpractice.js
More file actions
40 lines (31 loc) · 810 Bytes
/
Copy pathpractice.js
File metadata and controls
40 lines (31 loc) · 810 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
29
30
31
32
33
34
35
36
37
38
39
40
let myString = "fola"
palindrome = ""
for (let count = 0; count < myString.length; count++){
palindrome = myString.charAt(count) + palindrome
}
console.log(palindrome)
function isPalindrome(myString){
palindrome = ""
for (let count = 0; count < myString.length; count++){
palindrome = myString.charAt(count) + palindrome
}
if (myString == palindrome)
return true;
else
return false;
}
let my_list = ["fathia", "madam", "12321"]
let new_list = []
for(let count = 0; count < my_list.length; count++){
palindrome = ""
for (let counter = 0; count < my_list[count].length; counter++){
palindrome = my_list[count].charAt(counter) + palindrome
}
if (my_list[count] == palindrome){
new_list[count] = true;
}
else{
new_list[count](false);
}
}
console.log(new_list[0])