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
    
  
  
    
  | // Understanding apply, call and bind | |
| // call | |
| const person = { | |
| first: 'Satyam', | |
| last: 'Saluja' | |
| } | |
| console.log(person.first + ' ' + person.last); | 
  
    
      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
    
  
  
    
  | // reduce | |
| function myReduce(callback, initial) { | |
| let acc = (initial === undefined) ? undefined : initial; | |
| for (let i = 0; i < this.length; i++) { | |
| if (acc !== undefined) { | |
| acc = callback(acc, this[i], i, this); | |
| } else { | |
| acc = this[i]; | |
| } | 
  
    
      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
    
  
  
    
  | header p:hover, | |
| main p:hover, | |
| footer p:hover { | |
| color: red; | |
| cursor: pointer; | |
| } | 
  
    
      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
    
  
  
    
  | function display(data){ | |
| console.log(data) | |
| } | |
| function printHello(){ | |
| console.log(“Hello”); | |
| } | |
| function blockFor300ms(){ | |
| /* blocks js thread for 300ms with long for loop */ | |
| } | 
  
    
      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
    
  
  
    
  | function sayHello() { | |
| console.log('Hello!'); | |
| } | |
| function sayBye() { | |
| console.log('Bye!'); | |
| } | |
| setTimeout(sayHello, 1000); | |
| setTimeout(sayBye, 2000); | 
  
    
      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
    
  
  
    
  | getData(function(x){ | |
| getMoreData(x, function(y){ | |
| getMoreData(y, function(z){ | |
| ... | |
| }); | |
| }); | |
| }); | 
  
    
      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
    
  
  
    
  | function fetchUsers(userId, callback) { | |
| // call some magical API | |
| callback(user); | |
| } | |
| // calling the above function | |
| fetchUsers('some_id', (user) => { | |
| console.log('My user object', user); | |
| }); | 
  
    
      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
    
  
  
    
  | console.log('Beginning of code sample'); | |
| document.getElementById('mybutton').addEventListener('click', () => { | |
| console.log("You clicked the button!") | |
| }); | |
| console.log('End of code sample'); | 
  
    
      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
    
  
  
    
  | const num1 = 1; | |
| const num2 = 2; | |
| console.log(`Sum of ${num1} and ${num2} is `, num1+num2); | 
  
    
      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
    
  
  
    
  | return Scaffold( | |
| appBar: AppBar(title: Text(title)), | |
| body: Center(child: Text('Hola thy friend!')), | |
| drawer: Drawer( | |
| child: ListView( | |
| padding: EdgeInsets.zero, | |
| children: <Widget>[ | |
| DrawerHeader( | |
| child: Text('Drawer Header'), | |
| decoration: BoxDecoration( | 
NewerOlder