This file contains hidden or 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
/*check mdn Number.isNaN*/ | |
/*mdn example*/ | |
Number.isNaN = Number.isNaN || function(value) { | |
return typeof value === "number" && value !== value; | |
} |
This file contains hidden or 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
var sum = 0; for(var i=0 ; i<1000 ; i++){if (!(i%3) or !(i%5) ) sum+=i} console.log(sum); |
This file contains hidden or 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
var fib = [1,2] , i=0;j=1 , index=2 , sum=2; | |
while ( fib[j]<4*Math.pow(10,6) ){ | |
fib[index] = fib[i]+fib[j]; | |
if (4*Math.pow(10,6)<=fib[index]) { | |
break; | |
} | |
if ( !(fib[index]%2) ) | |
sum+=fib[index]; |
This file contains hidden or 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.time('mapping in js'); | |
var isAType = {}; | |
isAType._array = "[object Array]"; | |
isAType._function = "[object Function]"; | |
isAType._string = "[object String]"; | |
isAType.isFunction = function(fn) { | |
return Object.prototype.toString.call(fn) === this._function; | |
} |
This file contains hidden or 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
var isPalindrome = function(text){ | |
while(text.length!=1){ | |
var firstChar = text.charAt(0); | |
var lastChar = text.charAt(text.length-1); | |
if (firstChar===lastChar){ | |
text = text.substr(1,text.length-2); | |
} | |
else{ | |
return false; | |
} |
This file contains hidden or 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
(function(){ | |
var first_words = ["iceman","animal"]; | |
var second_words = ["cinema","lamina"]; | |
check_anagrams(first_words, second_words); | |
function check_anagrams(first_words, second_words) { | |
// To print results to the standard output please use console.log() | |
// Example: console.log("Hello world!"); | |
function anagram(first_word,second_word){ | |
firstArr = first_word.split(''); |
This file contains hidden or 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
var myHN = function (){ | |
var happyClosure = function(number){ | |
//started at | |
var timeStamp = new Date().getTime(); | |
//save original number | |
var happyNumber = number; | |
//iterations done |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
.miniSliderContainer{ | |
padding-bottom: 9em; | |
width: 100%; | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); |
This file contains hidden or 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
function attachEventApart(object, cB, event, onEvent){ | |
if (object.addEventListener){ | |
object.addEventListener(event, cB, false); | |
} | |
else if (window.attachEvent){ | |
object.attachEvent(onEvent, cB); | |
} | |
else | |
object[onEvent] = cB; | |
} |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://mootools.net/download/get/mootools-core-1.4.5-full-compat-yc.js"></script> | |
<script src="coffee.js"></script> | |
<title></title> | |
<style> | |
*[id*="S1_98"]{ | |
display:none; | |
} |