This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string1 = 'level'; | |
const string2 = 'Le, vel.'; | |
const isPalindrome = (stringToTest1, stringToTest2) => { | |
const stringToTestTransformed1 = stringToTest1 | |
.replace(/[^\w]/gi, '') // replace all non-lettter characters | |
.toLowerCase(); // make all characters lower cased | |
const stringToTestTransformedAndReversed2 = stringToTest2 | |
.replace(/[^\w]/gi, '') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string1 = 'level'; | |
const string2 = 'house'; | |
const isPalindrome = stringToTest => stringToTest === stringToTest.split('').reverse().join(''); | |
isPalindrome(string1); // true | |
isPalindrome(string2); // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const string1 = 'level'; | |
const string2 = 'Le, vel.'; | |
const isPalindrome = stringToTest => { | |
const stringTransformed = stringToTest | |
.replace(/[^\w]/gi, '') // replace all non-letter characters | |
.toLowerCase(); // make all characters lower cased | |
return stringTransformed === stringTransformed.split('').reverse().join(''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (s.indexOf('PM') > -1) // then do smth with PM | |
else // then do some other thing with AM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = s.slice(0,8).split(':'); | |
// '00:00:00AM' -> ['00', '00', '00'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PM case | |
if (arr[0] == 12) { // as 12 is the string I use ==, but you can rewrite it like === '12' | |
arr[0] = '12'; | |
} else { | |
arr[0] = Number(arr[0]) + 12; // if we add number to string we will get new string like '1312' | |
} | |
// AM case | |
if (arr[0] == 12) { | |
arr[0] = '00'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = s.slice(0,8).split(':'); | |
arr[0] = (s.indexOf('PM') > -1) ? | |
(arr[0] == 12 ? '12' : Number(arr[0]) + 12) : | |
(arr[0] == 12 ? '00' : arr[0]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arr = s.slice(0,8).split(':'); | |
arr[0] = (s.indexOf('PM') > -1) ? | |
(arr[0] == 12 ? '12' : Number(arr[0]) + 12) : | |
(arr[0] == 12 ? '00' : arr[0]); | |
return arr.join(':'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.blured-circle { | |
filter: blur(1.2vmax); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.blurred-wrapper { | |
filter: contrast(7); | |
} |
OlderNewer