You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The call() method of Function instances calls this function with a given this value and arguments provided individually.
6
+
7
+
Function.prototype.apply():
8
+
The apply() method of Function instances calls this function with a given this value, and arguments provided as an array (or an array-like object).
9
+
10
+
Function.prototype.bind()
11
+
With the bind() method, an object can borrow a method from another object. The bind() method of Function instances creates a new function that, when called, calls this function with its this keyword set to the provided value, and a given sequence of arguments preceding any provided when the new function is called.
12
+
13
+
The difference is:
14
+
The call() method takes arguments separately.
15
+
The apply() method takes arguments as an array.
16
+
17
+
*/
18
+
19
+
constcar={
20
+
name: 'car',
21
+
color: 'black',
22
+
getDetails(brand,seats){
23
+
console.log(`This is a ${this.color}${this.name} of ${brand} company. It has ${seats} seats`);
setTimeout: The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires. Also it will start to execute in next line even timeout function not executed.
The setInterval() method, offered on the Window and WorkerGlobalScope interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
5
+
6
+
setInterval() method returns an interval ID which uniquely identifies the interval, so you can remove it later by calling clearInterval().
0 commit comments