This document is written to help JavaScript developers to understand JavaScript's weird parts deeply and to prepare for interviews, the following resources was really helpful to write this document:
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
// The function that scales an images with canvas then runs a callback. | |
function scaleImage(url, width, height, liElm, callback){ | |
var img = new Image(), | |
width = width, | |
height = height, | |
callback; | |
// When the images is loaded, resize it in canvas. | |
img.onload = function(){ | |
var canvas = document.createElement("canvas"), |