how to call a function in javascript – The call() method is a predefined JavaScript method. It is used to call a function contains this value and an argument provided individually.
how to call a function in javascript
The call() method is used to write methods for different objects. there are main 4 ways to call a function in JavaScript. As a function, As a method, As a constructor and via call and apply.
Calling a function as a function
force the context to be undefined
Calling a function as a method
Don't Miss : Call Javascript Function From Html
Calling a function via call and apply
//call accepts a list of values displayProfile.call(valueOfThis, 1, 2, 3); //apply accepts an array of values displayProfile.apply(valueOfThis, [1, 2, 3]);
I hope you get an idea about how to call a function in javascript.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.