Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript Inside a regular function

function Person() {
    this.name = 'Jack',
    this.age = 25,
    this.sayName = function () {
        // this is accessible
        console.log(this.age);

        function innerFunc() {
            // this refers to the global object
            console.log(this.age);
            console.log(this);
        }

        innerFunc();

    }
}
let x = new Person();
x.sayName();
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript Passing undefined Value 
Javascript :: return number less than in 250 
Javascript :: javascript Access Set Elements 
Javascript :: javascript Nested Destructuring Assignment 
Javascript :: fetch second parameters 
Javascript :: javascript Undeclared objects are not allowed 
Javascript :: random number 1-3 
Javascript :: javascript function invocation 
Javascript :: actionscript round roundnumber 
Javascript :: React ES6 Modules 
Javascript :: lookup in other document in array 
Javascript :: jquery put value in table 
Javascript :: mongoose schema index of multiple columns 
Javascript :: Warning: Problem validating app.json: Unable to perform cache refresh for 
Javascript :: find minimum 
Javascript :: phaser animation get progress 
Javascript :: phaser tween timescale 
Javascript :: data tables ajust columns after init 
Javascript :: js undici 
Javascript :: react three fiber cannon collision 
Javascript :: mongo db backup node js daily 
Javascript :: javascript setinterval run immediately 
Javascript :: how to delete an element from an array in javascript 
Javascript :: e.target.value with number 
Javascript :: reactnative timepicker 
Javascript :: angular number validation 
Javascript :: fuzzy search javascript 
Javascript :: age calculator moment js 
Javascript :: how to unfreeze object in javascript 
Javascript :: javascript pass array by value 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =