Created
December 11, 2015 19:30
-
-
Save matiasherranz/1621d680f878d11199c7 to your computer and use it in GitHub Desktop.
http://collabedit.com/n38gj -- playing with js.js
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
function Car() { | |
} | |
Car.protoype = { | |
} | |
// can i make it singleton | |
for (var i=1; i<=5; i++) { | |
setTimeout( function timer(){ | |
console.log( i ); | |
}, i*1000 ); | |
} | |
for (var i=1; i<=5; i++) { | |
(function(){ | |
setTimeout( function timer(){ | |
console.log(i); | |
}, x*1000 ); | |
})(); | |
} | |
for (var i=1; i<=5; i++) { | |
setTimeout( function timer(i){ | |
console.log( i ); | |
}.bind(this, i), i*1000 ); | |
} | |
for (var i=1; i<=5; i++) { | |
setTimeout( function timer(t){ | |
console.log( t ); | |
}, i*1000, i ); | |
} | |
$("#someid") $("[id^=someid]") $('.someclass') | |
<script> | |
$('li').onclick(function(e){ | |
$('div').html('you clicked ' + $(this).html()); | |
}) | |
</script> | |
<ul> | |
<li> blah</li> | |
<li> blah2</li> | |
</ul> | |
<div> | |
you clicked blah | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment