Skip to content

Instantly share code, notes, and snippets.

View alvinyen's full-sized avatar

Alvin alvinyen

  • Taipei City, Taiwan
View GitHub Profile
@alvinyen
alvinyen / code of q2
Last active September 5, 2017 13:28
code of q2
function howManyNum7s (num) {
if (typeof num !== 'number' ||
isNaN(num) ||
!isFinite(num)) {
return 'Please pass in a correct number.';
}
if (num<7) {
return 0;
}
@alvinyen
alvinyen / code of q1
Last active September 7, 2017 09:04
code of q1
function printSequence (num) {
if (typeof num !== 'number' ||
isNaN(num) ||
!isFinite(num)) {
console.log('Please pass in a correct number.');
return;
}
let result = '';
let temp = '';
@alvinyen
alvinyen / destructuring.js
Created March 5, 2017 14:33 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];