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
// isPalindrome("level"); // Outputs true | |
// isPalindrome("levels"); // Outputs false | |
// isPalindrome("A car, a man, a maraca"); // Outputs true | |
function isPalindrome(str) { | |
// We will replace any non-word character with empty place. | |
// Lowercase all string | |
str = str.replace(/\W/g, '').toLowerCase(); |
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
// console.log(sum(2,3)); // Outputs 5 | |
// console.log(sum(2)(3)); // Outputs 5 | |
function sum(x){ | |
if (arguments.length == 2){ | |
// In functions arguments received as array. | |
// We need to check if their is two or one argument in array. | |
return arguments[0] + arguments[1]; | |
} else { |
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
window.print(); |
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
// Today is : Friday. | |
// Current time is : 4 PM : 50 : 22 | |
var days = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; | |
var a = new Date(); | |
var hour = a.getHours(); | |
console.log("Today is : " + days[a.getDay()]); | |
console.log("Current time is : " + getH(hour) + " " + a.getMinutes() + ":" + a.getSeconds()); |
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
/*! | |
* Greetr JavaScript Library v0.0.1 | |
* | |
* Date: 2017-02-07T11:40Z | |
*/ | |
;(function(global, $){ | |
// 'new' an object | |
var Greetr = function(firstName, lastName, language) { | |
return new Greetr.init(firstName, lastName, language); |
NewerOlder