#Day36 & 37
Morning exercise: https://gist.github.com/mathildathompson/10071564
When converting an array of string to an array of numbers, .map returns an altered array and .each returns the original array.
counter++ takes the current value of counter and returns the original ++counter adds 1 to counter and then returns it.
Same origin policy
Create platform to post on all social networks at the same time.
Having access with Javascript to the content from a different page
The ajax transation may take longer to finish then the code you write underneath so you need to specify to wait until the request is finished to execute the rest of the code.
Example:
var request = $.ajax({
type: 'GET',
url: '/random',
success: function(){
console.log("The request is finished");
console.log("Your random number is: ", request.responseText); // This will work
}
});
console.log("Your random number is: ", request.responseText); //This will fail.
This way is better:
$(document).ready(function(){
$('button').on("click", function(){
var request = $.ajax({
type: 'GET',
url: '/random',
success: function(){
console.log("The request is finished");
console.log("Your random number is: ", request.responseText);
}
});
});
});
Even better way:
$(document).ready(function(){
$('button').on("click", function(){
$.ajax({
type: 'GET',
url: '/random',
success: function(number){
$('#number').text(number);
}
});
});
});
#Day 37
Morning exercise: https://gist.github.com/wofockham/5a22e6aadb568a3c8e20
Bit field: http://en.wikipedia.org/wiki/Bit_field
learn jquery: http://learn.jquery.com/
jQuery plugins: https://plugins.jquery.com/tag/animation/