Picture by Artem Sapegin on Unsplash

JavaScript is a welcoming language - admittedly, one that takes much longer to master than it does to learn.

At work, I’ve been working on interesting bits and pieces which are helping me solidify my knowledge. Here are some interesting as well as mundane things I’ve gotten comfortable with recently.

window.print() is not a part of ECMAScript


I was surprised to learn that window.print() is not a spec - only a Living Standard. From a cursory test, it seems Firefox for Android does not know what to do with window.print() whereas Chrome for Android does. If you wrap your website in an Android WebView or UIWebView/WKWebView, neither Android nor iOS will get you anywhere with a call to this function.

Android’s developer documentation specifically states:

You cannot use JavaScript in a HTML document to trigger printing.

Object spread syntax to write flexible constructors and methods



const createShape = (config) => {
    return {
        length: 50,
        breadth: 30,

let sqauare = createShape({ breadth: 50 });
let cube = createShape({ height: 75 });

You can add additional key-value pairs, or overrwrite an existing pair, or both!

It was a tweet by @wesbos that really solidified it as a pattern in my memory, despite having used it at work several times.

Your browser can find out a lot about your battery

Your browser lets anyone query what the status and charge level of your battery is. How cool and frightening is that?

JavaScript Navigator's getBattery

An interesting Atom keyboard shortcut

I love keyboard shortcuts - easing them into your mental map and muscle memory is a huge plus to your day-to-day productivity, without the stress of remembering 20 keyboard combinations all at once.

I chanced upon Ctrl + R which generates symbols and lets you look through or search just the methods in a file. This is what it looks like in a React file using ES6 classes:

Atom keyboard shortcut preview