Skip to content

Author: admin@master

Download Object As Formatted JSON File

I followed this guide to download a JSON object from the browser. This is what my code looks like: But this gives me a single line file that is hard to read. Is there an easy way to format it as a readable JSON file, with newlines and indentation? Answer The JSON.stringify has three parameters, you can use th…

JavaScript/React Style Guide Indentation

Is there an agreed-upon convention for indentation in React JSX? 2 spaces, 4 spaces, tabs, etc. Answer You should just use the same indentation as the rest of your javascript code. That said react ecosystem seems to use mostly double spaces so I’d use that for consistency.

Array of objects intersection

I have two lists of objects and I would like to filter my array1 without the file key that are in the array2 : What I did : This returns exactly the array1 whereas if I replace != with == it returns the objects I want to get rid of. I don’t understand why. https://jsfiddle.net/hrzzohnL/1/ So at the end …

google chrome console, print image

About year ago i created a plugin to enhance console logs, main idea was to print images in console, so for example You could add some icons or glyphs. It was working pretty nice, i saw that there is many of those available online right now. The problem is that none of them are working atm. I noticed it after