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
var map; | |
var infowindow; | |
var searchwords = "agence+web"; | |
// Initiate Map | |
function initMap() { | |
var paris = {lat: 48.8704907, lng: 2.3309359}; | |
map = new google.maps.Map(document.getElementById('map'), { | |
center: paris, |
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
var greeting = "Hi, I am a global variable"; // global scope variable | |
function sayHello() { | |
var greeting = "Hi, I am a local variable"; // local scope variable | |
console.log(greeting); | |
} | |
sayHello(); // Prints "Hi, I am a local variable" | |
console.log(greeting); // Prints "Hi, I am a global variable" |
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 bakeCake(ingredient){ | |
// Code that adds the ingredient to the cake batter | |
console.log(ingredient+ ' cake : add ' +ingredient+ ' to the batter'); | |
function ovenTemperature(temperature, time){ | |
// Code that sets the right temperature for baking the cake | |
console.log('Set the oven temperature to ' +temperature+' and ready to bake the '+ingredient+' cake for ' +time+ ' minutes'); | |
} | |
return ovenTemperature; | |
} |
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
var d = new Date(); | |
var d = new Date(milliseconds); | |
var d = new Date(dateString); | |
var d = new Date(year, month, day [,hour,minute,second,millisecond ]); |
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
for (var i = 0; i < 10; i++) { | |
(function (j) { | |
setTimeout(function() { | |
console.log(j); | |
}, j*1000); | |
})(i); | |
} |
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
for (var i = 0; i < 10; i++) { | |
function timer(j) { | |
setTimeout(function() { | |
console.log(j); | |
}, j*1000); | |
}; | |
timer(i); | |
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
for (var i = 0; i < 10; i++) { | |
console.log(i); | |
setTimeout(function() { | |
console.log(i); | |
}, i*1000); | |
} |
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(myFunction()); | |
// Prints | |
function add(number2) { | |
return number1 + number2; | |
} |
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 myFunction(number1) { | |
function add(number2) { | |
/* The number1 variable is accessible from this function, | |
because number1 has been defined outside of the add function */ | |
return number1 + number2; | |
} | |
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
for (var i = 0; i < 10; i++) { | |
setTimeout(function() { | |
console.log(i); | |
}, i*1000); | |
} |
NewerOlder