If you have any query feel free to chat us!
Happy Coding! Happy Learning!
In strict mode, the value of this
inside a function is not coerced to the global object. Instead, if the function is called with a this
value of undefined
or null
, this
will remain undefined
or null
, respectively. This behavior helps to prevent common programming errors and makes it easier to write more secure code.
For example:
javascriptCopy code
'use strict';
function example() {
console.log(this);
}
example(); // logs undefined
In non-strict mode, the same code would log the global object (window
in a browser environment).
Note that this behavior only applies to function calls made in strict mode. If a function is called in non-strict mode, the value of this
will still be coerced to the global object if it is undefined
.
Comments: 2
I am not able to access videos from second class and further. I have already completed first class
When will I get my course?
Now, Your query was resolved.