Last active
May 13, 2016 08:44
-
-
Save man27382210/2eb878c5b01366c4e11d8704118c0b3c to your computer and use it in GitHub Desktop.
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
/* | |
* The following code snippet runs in an angular controller body. | |
* It tries to convert a blob object "data" into data URL and bind the result to the scope. | |
* Fix it so that $scope.data will make UI change as expected. | |
*/ | |
/* global angular, data, FileReader */ | |
angular.module('xxx').controller('Ctrl', ['$scope', function ($scope) { | |
var reader = new FileReader(); | |
reader.onload = function (event) { | |
$scope.data = event.target.result; | |
}; | |
reader.readAsDataURL(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
/* | |
* Please describe different of bind, call, apply. | |
*/ |
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
/* | |
* Fix the following code snippet to make it work. | |
* You can only modify line 7. | |
* (Assume that <div id="page1"></div> exists) | |
*/ | |
var g = document.getElementById; | |
g('page1').innerHTML = 'Hello World!'; |
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
/* | |
* Discuss the possible console output results for this code snippet. | |
* The "doSomething" function accepts a callback function as the input argument, | |
* but whether it is synchronus or asynchronus remains unknown. | |
*/ | |
/* global doSomething */ | |
console.log('hello 1'); | |
setTimeout(function () { | |
console.log('hello 2'); | |
}, 1); | |
console.log('hello 3'); | |
doSomething(function (result) { | |
console.log('doSomething done'); | |
}); | |
setTimeout(function () { | |
console.log('hello 4'); | |
}, 0); | |
console.log('hello 5'); |
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
/* | |
* Please describe different of React.js, Angular.js. | |
* Which one you will choice. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment