Created
June 27, 2015 21:03
-
-
Save charlieroberts/efe3012eb019fcb431b6 to your computer and use it in GitHub Desktop.
playing around with https://babeljs.io/repl/
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
let a = d => d * 4 | |
const test13 = 'TESTING ! 2 3' | |
let e = [1,2,3] | |
let f = e.map( v => v * 2 ) | |
let test = { | |
a : 'me', | |
friends: [], | |
showFriends() { | |
this.friends.forEach( friend => console.log( this.a + ' knows ' + f )) | |
}, | |
} | |
class Widget { | |
constructor( a,b ) { | |
console.log("WIDGET", a, b) | |
this.testing = a * b | |
} | |
blah () { return 'blah' } | |
} | |
class Slider extends Widget { | |
constructor( a,b ) { | |
super( a,b ) | |
this.x = this.y = 0 | |
} | |
static number = 10 | |
move( xamt, yamt ) { | |
this.x += xamt | |
this.y += yamt | |
} | |
} | |
var z = new Slider( 2, 4 ) | |
z.move( 10, 2 ) | |
Slider.number = 5 | |
console.log( Slider.number ) | |
var q = new Slider( 5, 10 ) | |
Slider.number = 20 | |
console.log( Slider.number ) | |
console.log( q.blah(), q.testing ) | |
let urk = { a: 1 } | |
let hmm = 'hmmm' | |
let urk2 = { | |
__proto__: urk, | |
hmm, | |
[ hmm + '33' ] : 42 | |
} | |
console.log( urk2.a, urk2.hmm, urk2.hmmm33 ) | |
let stringTest = `this is a | |
test.` | |
let nice = `${stringTest} is great ${ 5 + 10 * 20 }!` | |
console.log( nice ) | |
var {test1:x,test2:y,test3:z} = { test1:1, test2:2, test3:3 } | |
var [q, , w] = [1,2,3] | |
var {test1, test2, test3 } = { test1:1, test2:2, test3:3 } | |
console.log( x,y,z ) | |
console.log( test1, test3 ); | |
var tt = [0,0,0].fill('hi',2) | |
console.log( tt.indexOf('hi') ) | |
console.log( tt ) | |
let aa = function(duration = 0, r ) { | |
return new Promise( (res, rej) => { | |
setTimeout( res, duration ) | |
}) | |
} | |
let p = aa( 1000 ) | |
p.then(() => { console.log("EHROEH") }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment