/snippets

A collection of useful code snippets and CSS properties

Snippets

A collection of my favourite code, including native functions, methods, and CSS properties.

CSS

Object-fit

The object-fit CSS property specifies how the contents of a replaced element, such as an or

Working example

JS

If object doesn't exist create one

if (!obj[d]) { obj[d] = {} obj[d][n.subject] = {id: n.id, views: n.views} } else { obj[d][n.subject] = {id: n.id, views: n.views} }

Is the same as:

const day = obj[d] || (obj[d] = {}) day[n.subject] = {id: n.id, views: n.views}