Skip to content

Instantly share code, notes, and snippets.

View jialinhuang00's full-sized avatar
😃

jialin.huang jialinhuang00

😃
View GitHub Profile
/*-----------------------------------------------------------------------------
1.reverse every word in the sentence.
2.the orders between words do not change.
the reference used at the second function is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch
-----------------------------------------------------------------------------*/
function reverseWords(str) {
return str.split('').reverse().join('');
}
/*-----------------------------------------------------------------------------
1.turn every word into another word by the same process.
2.just like a puzzle
3.the map() method need to assigned to a variable.
the reference is by me, oh yah.
-----------------------------------------------------------------------------*/
function caesarCipher(str, num) {
arr = str.split("");
/*-----------------------------------------------------------------------------
1.check if the string that reversed is as same as the origin.
2.ignoring the situation like upper or lower, and punctuation.
the reference used at the second function is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch
-----------------------------------------------------------------------------*/
function isPalindrome(string) {
var reg = /[a-z]/g;
/*-----------------------------------------------------------------------------
1.check if the 1st argument's words is existing at the 2nd argument.
2.the function is used to check if the latter is more apples than the former.
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch
-----------------------------------------------------------------------------*/
/*******************************************
NOTES:Time complexity, Big O notation()
/*-----------------------------------------------------------------------------
1.check the multiple
2.the fifteen's case must be first.
the reference is from UdemyCourse: LearningAlgorithmsInJavascriptFromScratch
-----------------------------------------------------------------------------*/
// 15X ->> 'FizzBuzz'
// 5X ->> 'buzz'
// 3X ->> 'fizz'
function fizbuz(n) {
Name Character Entity
Copyright © ©
Registered ® ®
Trademark ™ ™
Curly Open Double Quote “ “
Curly Closed Double Quote ” ”
Curly Open Single Quote ‘ ‘
Curly Closed Single Quote ’ ’
Big Bullet/Dot • •