Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

inner function in javascript

function name(firstName,lastName){
  function getFullName(){
    console.log(firstName,lastName);
  }
  getFullName();
}
name('Jaw Jaw', 'Rakhaine');
//Output will be
//Jaw Jaw Rakhaine
Comment

javascript this Inside Inner Function

const person = {
    name : 'Jack',
    age: 25,
    // this inside method
    // this refers to the object itself
    greet() {
        console.log(this);        // {name: "Jack", age ...}
        console.log(this.age);  // 25
        // inner function
        function innerFunc() {
                    // this refers to the global object
            console.log(this);       // Window { ... }
            console.log(this.age);    // undefined
            
        }

        innerFunc();
    }
}

person.greet();
Comment

PREVIOUS NEXT
Code Example
Javascript :: string to array in js 
Javascript :: route with parameter react not working not found 
Javascript :: map values in range js 
Javascript :: javascript object/function which you want to proxy 
Javascript :: save to local storage 
Javascript :: numbers split 
Javascript :: what is prototype in javascript 
Javascript :: how to select a dom element in react 
Javascript :: sequelize queryinterface select 
Javascript :: run javascript runtime 
Javascript :: how to print a list in javascript 
Javascript :: javascript if return true false 
Javascript :: java script alerts 
Javascript :: javascript add method to a class 
Javascript :: word table to json 
Javascript :: method function difference 
Javascript :: document.createelement with id 
Javascript :: nodejs date add days 
Javascript :: mongoose create text index to search for text 
Javascript :: javascript map() method 
Javascript :: copy to clipboard jquery 
Javascript :: javascript filter method 
Javascript :: JavaScript ForEach This Argument 
Javascript :: array unshift 
Javascript :: js exports 
Javascript :: javascript draw canvas grid 
Javascript :: javaScript throw statement 
Javascript :: js remove entry 
Javascript :: sails js 
Javascript :: define function js 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =