What you didn’t know about JSON.parse


Now that you know some more about JSON.stringify; let's dive into its complement: JSON.parse. 1. JSON.Parse The JSON parse function takes in a string (invalid JSON will cause a SyntaxError exception). If parsing succeeds, JSON.parse returns the corresponding value or object. 2. The reviver function JSON.parse accepts an optional reviver function. This reviver function, if specified, allows you … Continue reading What you didn’t know about JSON.parse

What you didn’t know about JSON.Stringify


This post shows a couple of new tricks and ways to properly leverage the hidden capabilities of JSON.stringify covering: JSON expectations and non-serializable data formats, How to use toJSON() to define objects properly for JSON serialization, The replacer option for filtering out values dynamically, the spaceparameter for formatting JSON output. The post also covers the difference between stringifying arrays and objects containing non-stringifiable fields

Understanding JavaScript Property Descriptors 2


If this is your first time here, you should read the first post in this series. Then come back to this to continue. Continuing with the dive into property descriptors, this post goes deeply into the properties, what they mean and how they can be used. 1. Modifying existing properties The defineProperty method allows users to create and modify … Continue reading Understanding JavaScript Property Descriptors 2

Learning ES2015 : let, const and var


Lions at the zoo Zoos allow for safely viewing dangerous wild animals like lions. Lions are caged in their enclosures and can't escape its boundaries (if they did, it'd be chaos eh?). Handlers, however, can get into cages and interact with them. Like cages, you can think of variable scoping rules as establishing the boundaries and walls in … Continue reading Learning ES2015 : let, const and var

Chrome dev tools deep dive : Console


The console is one of favorite places. The REPL environment is a quick way to validate JavaScript expressions. However, there is a lot more it can do. Read on. 1. $0 - $4 selectors The last inspected element is always available in the console as $0. $1 points to the next most-recently element and so … Continue reading Chrome dev tools deep dive : Console