{"id":493,"date":"2019-02-19T02:50:37","date_gmt":"2019-02-19T02:50:37","guid":{"rendered":"http:\/\/www.projectimmerse.com\/blog\/?p=493"},"modified":"2020-06-17T05:50:07","modified_gmt":"2020-06-17T05:50:07","slug":"javascripts-call-apply-and-bind-methods","status":"publish","type":"post","link":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/","title":{"rendered":"Javascript&#8217;s call, apply and bind methods"},"content":{"rendered":"<p>I&#8217;ve been mulling over getting this post up for a while now &#8211; simply because functions are a big deal in Javascript. Javascript functions are packed with so many properties, methods and it&#8217;s fundamental nature requires some quality time in understanding its features. <\/p>\n<p>There are a few things to keep in mind when dealing with Javascripts call(), apply, and bind methods()<\/p>\n<ul>\n<li>call(), apply() and bind() are three methods <strong>every function<\/strong> has access too<\/li>\n<li>bind() creates a copy of the function object in question<\/li>\n<li>call(), apply() and bind() methods are methods that allow an object to point to a different &#8216;this&#8217; variable when invoked.<\/li>\n<li>Common patterns used in conjunction with call(), apply() and bind() are function borrowing and function currying.<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p>Let&#8217;s check out a few examples mentioned in the items above. <\/p>\n<h2>Basic usage of the bind() method<\/h2>\n<p>I&#8217;m a big fan of the game <a href=\"https:\/\/clashroyale.com\/\" title=\"Clash Royale\">Clash Royale<\/a> so I&#8217;m going to be some contextual lingo from the game. <\/p>\n<p>But first, let&#8217;s attempt to run a process without using call(), apply() and bind() and see how it behaves:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\nvar logCard = function(card1, card2) {\r\n\r\n  console.log('Logged: ' + this.getCardDetails);\r\n\r\n}\r\n\r\nlogCard(); \/\/ this will output `undefined is not a function`\r\n\r\n<\/pre>\n<p>So the above code actually returns an error &#8211; this is no good. The &#8216;this&#8217; variable in this case is referencing the global variable &#8216;window&#8217; and &#8216;this.getCardDetails()&#8217; is sort of just lost &#8211; it detached within the confines of scope. It&#8217;s floating by itself basically.<\/p>\n<p>So how do we get this to work? Well, first let&#8217;s use bind(). <\/p>\n<h2>Let&#8217;s try again<\/h2>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\nvar logCard = function(card1, card2) {\r\n\r\n  console.log('Logged: ' + this.getCardDetails());\r\n\r\n}\r\n\r\n\/\/ make a copy of logCard and store it in logCardDeck\r\n\/\/ and the 'this' variable is now 'deck'\r\n\/\/ the javascript engine now decides 'deck' is the 'this' variable\r\nvar logCardDeck = logCard.bind(deck);\r\n\r\nlogCardDeck(); \/\/ will output Logged: Electro Wizard 5\r\n\r\n<\/pre>\n<p>Notice the comment I added above &#8220;Logged: Electro Wizard 5&#8221;, we get this output when the code is run &#8211; this is the bind() method doing it&#8217;s job. Also notice we didn&#8217;t pass any arguments for &#8220;card1&#8243; and card2&#8221; &#8211; we don&#8217;t get an error unless we log those arguments. <\/p>\n<h2>Ok, let&#8217;s runt he same code &#8211; this time pass in parameters for &#8220;card1&#8221; and &#8220;card2&#8221;<\/h2>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\nvar logCard = function(card1, card2) {\r\n\r\n  console.log('Logged: ' + this.getCardDetails());\r\n\r\n}\r\n\r\n\/\/ make a copy of logCard and store it in logCardDeck\r\n\/\/ and the 'this' variable is now 'deck'\r\n\/\/ the javascript engine now decides 'deck' is the 'this' variable\r\nvar logCardDeck = logCard.bind(deck);\r\n\r\nlogCardDeck('Fireball', 'Hog Rider'); \r\n\r\n\/\/ will output:\r\n\/\/ Logged: Electro Wizard 5\r\n\/\/ Cards: Fireball,Hog Rider\r\n\r\n<\/pre>\n<p>In that last example we passed in some parameters, so now we get &#8220;Cards: Fireball,Hog Rider&#8221; in addition to our original output. <\/p>\n<h2>Nice, so now we got a basic handle on bind(), we can ease into getting to know apply() and call().<\/h2>\n<p>The main difference is unlike bind() in which we create a copy of an object, call() and apply() actually executes it on the fly. Let&#8217;s see this in action.<\/p>\n<h3>Using call()<\/h2>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\nvar logCard = function(card1, card2) {\r\n\r\n  console.log('Logged: ' + this.getCardDetails());\r\n  console.log('Cards: ' + card1+','+ card2);\r\n}\r\n\r\nlogCard.call(deck, 'Fireball', 'Hog Rider');\r\n\r\n\/\/ will output:\r\n\/\/ Logged: Electro Wizard 5\r\n\/\/ Cards: Fireball,Hog Rider\r\n\r\n<\/pre>\n<p>Let&#8217;s do the same thing with apply() &#8211; the only difference is we&#8217;re passing an array type instead of a comma separated string as function arguments.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\nvar logCard = function(card1, card2) {\r\n\r\n  console.log('Logged: ' + this.getCardDetails());\r\n  console.log('Cards: ' + card1+','+ card2);\r\n}\r\n\r\nlogCard.call(deck, &#x5B;'Fireball', 'Hog Rider']);\r\n\r\n\/\/ will output:\r\n\/\/ Logged: Electro Wizard 5\r\n\/\/ Cards: Fireball,Hog Rider\r\n\r\n<\/pre>\n<p>Notice in the case above, we are passing &#8220;[&#8216;Fireball&#8217;, &#8216;Hog Rider&#8217;]&#8221; as an array not as a string &#8211; &#8220;&#8216;Fireball&#8217;, &#8216;Hog Rider&#8217;.<\/p>\n<h2>Using apply() with an IIFE (Immediately Invoked Function<\/h2>\n<p>I don&#8217;t think I covered IIFE&#8217;s in detail, this concept requires it&#8217;s own post &#8211; or even chapter for that matter. In this next example, we could see apply() being used in conjunction with IIFE&#8217;s. <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\n(function(card1, card2) {\r\n\r\n  console.log('Logged: ' + this.getCardDetails());\r\n  console.log('Cards: ' + card1+','+ card2);\r\n\r\n}).apply(deck, &#x5B;'Fireball', 'Hog Rider']);\r\n\r\n\/\/ will output:\r\n\/\/ Logged: Electro Wizard 5\r\n\/\/ Cards: Fireball,Hog Rider\r\n\r\n<\/pre>\n<p>Yeah that above code looks a little cryptic &#8211; trust me I had the same reaction but this is totally possible with javascript. We are invoking a function on the fly and calling a function on the fly while passing it parameters then outputting its results &#8211; ALL AT THE SAME TIME. Yeah I know. It&#8217;s like whoa, dude.<\/p>\n<p>Alright now onto function borrowing and function currying, first let&#8217;s tackle function borrowing.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nvar deck = {\r\n  card: 'Electro Wizard',\r\n  level: 5, \r\n  getCardDetails: function() {\r\n    var getCard = this.card + ' ' + this.level;\r\n    return getCard;\r\n  }\r\n}\r\n\r\nvar deck2 = {\r\n  card: 'Ice Wizard',\r\n  level: 9\r\n}\r\n\r\n\/\/ deck2 doesn't have that &quot;getCardDetails&quot; method\r\n\/\/ so let's borrow that method using apply()\r\n\r\nconsole.log(deck.getCardDetails.apply(deck2));\r\n\r\n\/\/ above will output\r\n\/\/ &quot;Ice Wizard 9&quot;\r\n\r\n<\/pre>\n<p>So you can borrow, or grab methods from other objects and functions &#8211; <strong>as long as<\/strong> you have similar property names.<\/p>\n<h2>Function currying &#8211; has to do with the bind() function. Creates a copy of a function<\/h2>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nfunction multiple(a, b) {\r\n\r\n  return a * b;\r\n\r\n}\r\n\r\nvar multipleByTwo = multiply.bind(this, 2);\r\n\r\nconsole.log(multipleByTwo);\r\n\r\n\/\/ will output \r\n\r\n\r\n<\/pre>\n<p>In this final example, we aren&#8217;t using call() or apply() &#8211; where we are calling the function, we are first creating &#8220;memory space for it&#8221; and then executing it. This is useful when we&#8217;re &#8220;setting up&#8221; an operation or parameters permanently in memory space.<\/p>\n<p>The last example the same thing as writing (the below) except with the bind() method &#8211; we are allowing a bit more flexibility. <\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\nfunction multipleByTwo(b) {\r\n\r\n  var a = 2;\r\n  return a * b;\r\n\r\n}\r\n\r\n<\/pre>\n<p>There&#8217;s really two important concepts to remember in all this:<\/p>\n<p>(1) bind() creates a copy of the function being curried in which parameters can be initially set or assigned<br \/>\n(2) call() and apply() immediately executes the function (or method) being borrowed.<\/p>\n<p>This is a general overview of call(), apply() and bind() &#8211; I will write a separate post for each concept in future posts &#8211; stay tuned!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been mulling over getting this post up for a while now &#8211; simply because functions are a big deal in Javascript. Javascript functions are packed with so many properties, methods and it&#8217;s fundamental nature requires some quality time in understanding its features. There are a few things to keep in mind when dealing with &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Javascript&#8217;s call, apply and bind methods&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":1145,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-493","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Javascript&#039;s call, apply and bind methods - Project Immerse<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Javascript&#039;s call, apply and bind methods - Project Immerse\" \/>\n<meta property=\"og:description\" content=\"I&#8217;ve been mulling over getting this post up for a while now &#8211; simply because functions are a big deal in Javascript. Javascript functions are packed with so many properties, methods and it&#8217;s fundamental nature requires some quality time in understanding its features. There are a few things to keep in mind when dealing with &hellip; Continue reading &quot;Javascript&#8217;s call, apply and bind methods&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/\" \/>\n<meta property=\"og:site_name\" content=\"Project Immerse\" \/>\n<meta property=\"article:published_time\" content=\"2019-02-19T02:50:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-17T05:50:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/javascript-apply-call-bind-methods.png\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"750\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"projectimmerse\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"projectimmerse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/\"},\"author\":{\"name\":\"projectimmerse\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"headline\":\"Javascript&#8217;s call, apply and bind methods\",\"datePublished\":\"2019-02-19T02:50:37+00:00\",\"dateModified\":\"2020-06-17T05:50:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/\"},\"wordCount\":1140,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/javascript-apply-call-bind-methods.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/\",\"name\":\"Javascript's call, apply and bind methods - Project Immerse\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/javascript-apply-call-bind-methods.png\",\"datePublished\":\"2019-02-19T02:50:37+00:00\",\"dateModified\":\"2020-06-17T05:50:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/javascript-apply-call-bind-methods.png\",\"contentUrl\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/javascript-apply-call-bind-methods.png\",\"width\":750,\"height\":750,\"caption\":\"Javascrip's apply, call and bind methods\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/javascripts-call-apply-and-bind-methods\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Javascript&#8217;s call, apply and bind methods\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/\",\"name\":\"Project Immerse\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/#\\\/schema\\\/person\\\/c53f2864be524ee6fa08a7e4800dd1e5\",\"name\":\"projectimmerse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g\",\"caption\":\"projectimmerse\"},\"url\":\"https:\\\/\\\/www.projectimmerse.com\\\/blog\\\/author\\\/projectimmerse\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Javascript's call, apply and bind methods - Project Immerse","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/","og_locale":"en_US","og_type":"article","og_title":"Javascript's call, apply and bind methods - Project Immerse","og_description":"I&#8217;ve been mulling over getting this post up for a while now &#8211; simply because functions are a big deal in Javascript. Javascript functions are packed with so many properties, methods and it&#8217;s fundamental nature requires some quality time in understanding its features. There are a few things to keep in mind when dealing with &hellip; Continue reading \"Javascript&#8217;s call, apply and bind methods\"","og_url":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/","og_site_name":"Project Immerse","article_published_time":"2019-02-19T02:50:37+00:00","article_modified_time":"2020-06-17T05:50:07+00:00","og_image":[{"width":750,"height":750,"url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/javascript-apply-call-bind-methods.png","type":"image\/png"}],"author":"projectimmerse","twitter_card":"summary_large_image","twitter_misc":{"Written by":"projectimmerse","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#article","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/"},"author":{"name":"projectimmerse","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"headline":"Javascript&#8217;s call, apply and bind methods","datePublished":"2019-02-19T02:50:37+00:00","dateModified":"2020-06-17T05:50:07+00:00","mainEntityOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/"},"wordCount":1140,"commentCount":0,"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/javascript-apply-call-bind-methods.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/","url":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/","name":"Javascript's call, apply and bind methods - Project Immerse","isPartOf":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#primaryimage"},"image":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#primaryimage"},"thumbnailUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/javascript-apply-call-bind-methods.png","datePublished":"2019-02-19T02:50:37+00:00","dateModified":"2020-06-17T05:50:07+00:00","author":{"@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5"},"breadcrumb":{"@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#primaryimage","url":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/javascript-apply-call-bind-methods.png","contentUrl":"https:\/\/www.projectimmerse.com\/blog\/wp-content\/uploads\/2019\/02\/javascript-apply-call-bind-methods.png","width":750,"height":750,"caption":"Javascrip's apply, call and bind methods"},{"@type":"BreadcrumbList","@id":"https:\/\/www.projectimmerse.com\/blog\/javascripts-call-apply-and-bind-methods\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.projectimmerse.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Javascript&#8217;s call, apply and bind methods"}]},{"@type":"WebSite","@id":"https:\/\/www.projectimmerse.com\/blog\/#website","url":"https:\/\/www.projectimmerse.com\/blog\/","name":"Project Immerse","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.projectimmerse.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.projectimmerse.com\/blog\/#\/schema\/person\/c53f2864be524ee6fa08a7e4800dd1e5","name":"projectimmerse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4d06955033d6227bfdcf30014e457e4334f7deeb73907de49b65ec2484921931?s=96&d=mm&r=g","caption":"projectimmerse"},"url":"https:\/\/www.projectimmerse.com\/blog\/author\/projectimmerse\/"}]}},"_links":{"self":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/comments?post=493"}],"version-history":[{"count":7,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":501,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/posts\/493\/revisions\/501"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media\/1145"}],"wp:attachment":[{"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/media?parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/categories?post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.projectimmerse.com\/blog\/wp-json\/wp\/v2\/tags?post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}