JavaScript, JavaScript… https://javascriptweblog.wordpress.com by Angus Croll Mon, 02 Nov 2015 16:41:14 +0000 en hourly 1 http://wordpress.com/ https://s0.wp.com/i/buttonw-com.png JavaScript, JavaScript… https://javascriptweblog.wordpress.com Of Classes and Arrow Functions (a cautionary tale) https://javascriptweblog.wordpress.com/2015/11/02/of-classes-and-arrow-functions-a-cautionary-tale/ https://javascriptweblog.wordpress.com/2015/11/02/of-classes-and-arrow-functions-a-cautionary-tale/#comments <![CDATA[Angus Croll]]> Mon, 02 Nov 2015 14:30:55 +0000 <![CDATA[JavaScript]]> <![CDATA[arrow functions]]> <![CDATA[bind]]> <![CDATA[class]]> <![CDATA[Javascript]]> http://javascriptweblog.wordpress.com/?p=3478 <![CDATA[Behold, the new hotness! The shapely Arrow Function has driven away the irksome function keyword and (by virtue of lexical this scoping) bought joy to many a JavaScript programmer. Yet, as the following account relates, even the best tools should be used with discretion. A Hasty Refresher Traditional function expressions create a function whose this value … Continue reading Of Classes and Arrow Functions (a cautionary tale) ]]> https://javascriptweblog.wordpress.com/2015/11/02/of-classes-and-arrow-functions-a-cautionary-tale/feed/ 5 angus If Hemingway Wrote JavaScript: Explained. https://javascriptweblog.wordpress.com/2015/01/05/if-hemingway-wrote-javascript-explained/ https://javascriptweblog.wordpress.com/2015/01/05/if-hemingway-wrote-javascript-explained/#comments <![CDATA[Angus Croll]]> Mon, 05 Jan 2015 08:01:00 +0000 <![CDATA[JavaScript]]> http://javascriptweblog.wordpress.com/?p=3300 <![CDATA[I wrote a book called If Hemingway Wrote JavaScript in which I imagine 25 famous novelists, poets and playwrights solving simple problems in JavaScript. It’s part homage to my favorite writers and part love letter to JavaScript, the only language I know with enough freedom, creative potential and downright quirkiness to pique the interest of … Continue reading If Hemingway Wrote JavaScript: Explained. ]]> https://javascriptweblog.wordpress.com/2015/01/05/if-hemingway-wrote-javascript-explained/feed/ 9 angus Screen Shot 2015-01-04 at 4.33.55 PM Screen Shot 2014-12-30 at 3.00.13 PM Screen Shot 2014-12-30 at 2.43.10 PM scrooges Screen Shot 2015-01-01 at 8.06.03 PM Dan Brown Tupac Shakur Virginia Woolf William Shakespeare JavaScript Fat City https://javascriptweblog.wordpress.com/2012/04/09/javascript-fat-city/ https://javascriptweblog.wordpress.com/2012/04/09/javascript-fat-city/#comments <![CDATA[Angus Croll]]> Mon, 09 Apr 2012 07:01:49 +0000 <![CDATA[JavaScript]]> http://javascriptweblog.wordpress.com/?p=3147 <![CDATA[It’s official! We’re getting a new function syntax! The TC39 group (the panel charged with delivering ES 6) has reached consensus on an abbreviated syntax for JavaScript function expressions. Its popularly known as the fat arrow syntax, and is based on a similar construct found in CoffeeScript. Make no mistake, I’m delighted that we will … Continue reading JavaScript Fat City ]]> https://javascriptweblog.wordpress.com/2012/04/09/javascript-fat-city/feed/ 33 angus Extending JavaScript Natives https://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/ https://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/#comments <![CDATA[Angus Croll]]> Mon, 05 Dec 2011 08:01:01 +0000 <![CDATA[JavaScript]]> http://javascriptweblog.wordpress.com/?p=3025 <![CDATA[Most built-in JavaScript types are constructors whose prototypes contain the methods and other properties that define their default behavior: You can’t delete or replace a native prototype, but you can edit the values of its properties, or create new ones: Et voila! Our code gets a useful array extension for free. However if you brag … Continue reading Extending JavaScript Natives ]]> https://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/feed/ 54 angus Fixing the JavaScript typeof operator https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/ https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/#comments <![CDATA[Angus Croll]]> Mon, 08 Aug 2011 07:01:50 +0000 <![CDATA[JavaScript]]> <![CDATA[class]]> <![CDATA[duck-typing]]> <![CDATA[instanceof]]> <![CDATA[typeof]]> http://javascriptweblog.wordpress.com/?p=2838 <![CDATA[Working with JavaScript’s typeof operator is a bit like operating a clapped-out old car (or an early model Dell Inspiron). It gets the job done (mostly) and you learn to work around the quirks – but you probably aspire to something better. In this article I’ll give a brief overview of typeof before introducing a … Continue reading Fixing the JavaScript typeof operator ]]> https://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/feed/ 106 angus Waldo: Search the JavaScript Object Model in under 1 KB https://javascriptweblog.wordpress.com/2011/07/11/waldo-search-the-javascript-runtime-in-under-1-kb/ https://javascriptweblog.wordpress.com/2011/07/11/waldo-search-the-javascript-runtime-in-under-1-kb/#comments <![CDATA[Angus Croll]]> Mon, 11 Jul 2011 07:01:30 +0000 <![CDATA[JavaScript]]> <![CDATA[search runtime keys]]> http://javascriptweblog.wordpress.com/?p=2719 <![CDATA[Here’s a tiny util that you can save as a bookmarklet and use to crawl the JavaScript object model of any web site. Waldo (thanks to @shinypb for the name!) lets you find and inspect instances by name, type or value, and it can be easily customized to add additional tests. It runs in the … Continue reading Waldo: Search the JavaScript Object Model in under 1 KB ]]> https://javascriptweblog.wordpress.com/2011/07/11/waldo-search-the-javascript-runtime-in-under-1-kb/feed/ 15 angus Screen shot 2011-07-12 at 10.12.48 PM Screen shot 2011-07-12 at 10.18.14 PM Screen shot 2011-07-12 at 10.20.04 PM Screen shot 2011-07-12 at 10.25.50 PM Screen shot 2011-07-10 at 2.51.36 PM Screen shot 2011-07-10 at 2.54.25 PM Screen shot 2011-07-10 at 2.57.47 PM Screen shot 2011-07-10 at 2.58.38 PM Screen shot 2011-07-10 at 9.38.53 PM Screen shot 2011-07-10 at 3.18.12 PM A fresh look at JavaScript Mixins https://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/ https://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/#comments <![CDATA[Angus Croll]]> Tue, 31 May 2011 07:01:55 +0000 <![CDATA[JavaScript]]> <![CDATA[Inheritance]]> <![CDATA[mixins]]> <![CDATA[re-use]]> http://javascriptweblog.wordpress.com/?p=2613 <![CDATA[(Russian, Japanese) In this article I’ll explore JavaScript mixins in detail, and introduce a less conventional, but to my mind more natural mixin strategy that I hope you’ll find useful. I’ll finish up with a profiler matrix summarizing the performance impact of each technique. [A big Thank You to the brilliant @kitcambridge for reviewing and … Continue reading A fresh look at JavaScript Mixins ]]> https://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/feed/ 84 angus mixin Screen shot 2011-05-30 at 5.24.15 PM JavaScript Strict Mode https://javascriptweblog.wordpress.com/2011/05/03/javascript-strict-mode/ https://javascriptweblog.wordpress.com/2011/05/03/javascript-strict-mode/#comments <![CDATA[Angus Croll]]> Tue, 03 May 2011 07:01:58 +0000 <![CDATA[JavaScript]]> <![CDATA[strict mode]]> http://javascriptweblog.wordpress.com/?p=804 <![CDATA[The fifth edition of the ECMAScript specification introduced Strict Mode. Strict Mode imposes a layer of constraint on JavaScript – intended to protect you from the more perilous aspects of the language. While researching this article I wrote 38 tests covering all the Strict Mode rules as defined in the ES5 specification. You can see … Continue reading JavaScript Strict Mode ]]> https://javascriptweblog.wordpress.com/2011/05/03/javascript-strict-mode/feed/ 32 angus click to run these tests The JavaScript Comma Operator https://javascriptweblog.wordpress.com/2011/04/04/the-javascript-comma-operator/ https://javascriptweblog.wordpress.com/2011/04/04/the-javascript-comma-operator/#comments <![CDATA[Angus Croll]]> Mon, 04 Apr 2011 07:01:14 +0000 <![CDATA[JavaScript]]> <![CDATA[comma]]> <![CDATA[eval]]> <![CDATA[operator precedence]]> http://javascriptweblog.wordpress.com/?p=2261 <![CDATA[(на русском, 日本)   Let’s begin with a funny tweet: The ‘c’ at the end is for the lowly comma operator. Last in the line of operator precedence and rarely documented, the comma operator hides its light under a bushel. It may not be a JavaScript heavy-hitter but I like it anyway. Its simple, elegant … Continue reading The JavaScript Comma Operator ]]> https://javascriptweblog.wordpress.com/2011/04/04/the-javascript-comma-operator/feed/ 59 angus tweet Rethinking JavaScript Object Enumeration https://javascriptweblog.wordpress.com/2011/02/28/javascript-object-keys-finally/ https://javascriptweblog.wordpress.com/2011/02/28/javascript-object-keys-finally/#comments <![CDATA[Angus Croll]]> Mon, 28 Feb 2011 08:01:19 +0000 <![CDATA[JavaScript]]> <![CDATA[object keys arrays]]> http://javascriptweblog.wordpress.com/?p=2285 <![CDATA[In JavaScript, enumeration across regular (non-Array) Objects is often more painful than it should be. Arrays are merrily dispatched through for and while loops using all manner of crazy, fun techniques; Objects are forever at the mercy of the pedestrian, one directional for-in loop, without which we can’t even learn the names and length of … Continue reading Rethinking JavaScript Object Enumeration ]]> https://javascriptweblog.wordpress.com/2011/02/28/javascript-object-keys-finally/feed/ 34 angus