Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- const asyncSum = (number) => new Promise(resolve => setTimeout(() => resolve(number * 2), 2000))
- asyncSum(2).then(response => asyncSum(response).then( response=> console.log(response)))
- const trolo = async(num) => {
- const x = await asyncSum(num)
- const y = await asyncSum(num * 2)
- return x + y
- }
- trolo(3).then(response => console.log('trolololo' + response))
- class Animal {
- constructor(speed){
- this.speed = speed
- }
- speak(){
- }
- run(){
- console.log('animal running at ' + this.speed)
- }
- }
- class Gorilla extends Animal {
- run(speed){
- console.log('gorilla walking at ' + speed)
- }
- }
- const dog = new Animal(200)
- dog.run()
- const gori = new Gorilla()
- gori.run(100)
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">const asyncSum = (number) => new Promise(resolve => setTimeout(() => resolve(number * 2), 2000))
- asyncSum(2).then(response => asyncSum(response).then( response=> console.log(response)))
- const trolo = async(num) => {
- const x = await asyncSum(num)
- const y = await asyncSum(num * 2)
- return x + y
- }
- trolo(3).then(response => console.log('trolololo' + response))
- class Animal {
- constructor(speed){
- this.speed = speed
- }
- speak(){
- }
- run(){
- console.log('animal running at ' + this.speed)
- }
- }
- class Gorilla extends Animal {
- run(speed){
- console.log('gorilla walking at ' + speed)
- }
- }
- const dog = new Animal(200)
- dog.run()
- const gori = new Gorilla()
- gori.run(100)
- </script></body>
- </html>
Add Comment
Please, Sign In to add comment