guest@backslash:~/posts/javascript/js-useful-tricks$

JS useful tricks

~1 minjavascript web

Javascript useful things

Small standard JavaScript functions that I tend to forget, with links to MDN.

Clone and merge objects

MDN Object assign

js
// clone
const copy = Object.assign({}, obj);
// merge
const merged = Object.assign(o1, o2, o3);

Find in array

MDN Find

js
const item = items.find(p => p.id === 1);

BACKSLASH(1)                  User Commands

NAME
       backslash - keyboard navigation

KEYS
       j / k      scroll down / up
       n / p      next / previous post
       gg / G     top / bottom of the page
       /          filter posts
       ?          this help
       Esc        close