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 :: javascript Deleting an object is not allowed 
Javascript :: javascript variable name arguments and eval are not allowed 
Javascript :: can i copy package-lock.json to another project 
Javascript :: JavaScript Code Blocks 
Javascript :: JavaScript HTML DOM Navigation 
Javascript :: react linkify 
Javascript :: httpclient post raw json body 
Javascript :: jquery callback functions 
Javascript :: pizza form validation jquery 
Javascript :: promise limit time 
Javascript :: Could not resolve "i18n-iso-countries" 
Javascript :: roman to integer fastest way 
Javascript :: maximum product of word lengths leetcode solution 
Javascript :: phaser random ellipse 
Javascript :: phaser hide animation on complete 
Javascript :: add multiple phone using js 
Javascript :: on refresh action set position rainmeter 
Javascript :: Expresiones regulares para diferentes tipos de campos de formularios 
Javascript :: efectos javascript 
Javascript :: change on id 
Javascript :: jquery selectors 
Javascript :: javascript in jsx 
Javascript :: are you sure alert js 
Javascript :: node js mongodb update nested object 
Javascript :: js unshift vs push 
Javascript :: how to do division in javascript 
Javascript :: get the last item in an array 
Javascript :: copy folder in nodejs 
Javascript :: null is true or false javascript 
Javascript :: where from terminal colors come 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =