We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b4e2a9 commit 55d8010Copy full SHA for 55d8010
app.js
@@ -1,5 +1,6 @@
1
// call - runs instantly, arguments - list of items
2
// call - runs instantly, arguments - array of items
3
+// bind - assign, use later, arguments - list of items
4
5
const john = {
6
name: "john",
@@ -18,10 +19,6 @@ function greet(city, country) {
18
19
);
20
}
21
-// greet.call(john, "san diego", "us");
22
-// greet.call(susan, "san diego", "us");
23
-// greet.call({ name: "peter", age: 30 }, "san diego", "us");
24
-
25
-greet.apply(john, ["san diego", "us"]);
26
-greet.apply(susan, ["san diego", "us"]);
27
-greet.apply({ name: "peter", age: 30 }, ["san diego", "us"]);
+// assign, call it later
+const susanGreet = greet.bind(susan, "macomb", "illinois");
+susanGreet();
0 commit comments