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 myFunction (myArg1) { | |
return myArg1; | |
} | |
window.myFunction(1); |
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 firstObject = { | |
name: "firstFunction", | |
length: 0, | |
prototype: parentSecondObject | |
}; | |
var parentSecondObject = { | |
constructor: console.log("hello world") | |
} | |
firstFunction(); |
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
will evaluate to true if value is not: | |
null | |
undefined | |
NaN | |
empty string ("") | |
0 | |
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
// http://www.soundjay.com/rain-sound-effect.html | |
var audio = new Audio("http://www.soundjay.com/nature/rain-01.mp3"); | |
audio.play(); |
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
irm -Uri "https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json" -Method Get |
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 remoteUrlWithOrigin = "https://en.wikipedia.org/w/api.php?action=query&titles=Main%20Page&prop=revisions&rvprop=content&format=json"; | |
// Using jQuery | |
jQuery.ajax( { | |
url: remoteUrlWithOrigin, | |
//because of cross-orginig error that is why jsonp | |
dataType: 'jsonp', | |
type: 'GET', | |
//which function to call when all is succeseed | |
success: function(data) { | |
// do something with data |
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
//jQuery: $("#foo").empty(); | |
var myNode = document.getElementById("foo"); | |
while (myNode.firstChild) { | |
myNode.removeChild(myNode.firstChild); | |
} |
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
//try to find 7923 | |
for (var i=Number(window.location.href.toString().replace(/\D/ig,""));i<=7923;i++) { | |
window.location.href = window.location.href.replace(/\d/ig,"") + i; | |
} |
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 animal = { | |
eats: true | |
}; | |
function Rabbit(name) { | |
this.name = name; | |
//this.__proto__ = animal; | |
} | |
Rabbit.prototype = animal;// what save to __proto__ after calling new Rabbit("string"); this line does not do anything, it require new operator |