justify-content = main axis
align-items = cross axis
align-content = cross axis with wrap; to be used when weird gap appear between rows/columns
photo gallery: grid-template-columns: repeat(auto-fit, minmax(154px, 1fr));
const str = "I can speak {日本語,にほんご} read {漢字,かんじ}" | |
const regex = /{(\S+?),(\S+?)}/g | |
const newStr = str.replace(regex, ` | |
<ruby> | |
$1 <rp>(</rp><rt>$2</rt><rp>)</rp> | |
</ruby>`) |
const obj = {video: {name: 'cat', duration:30}} | |
obj.map({video} => video.cat, video.duration) | |
const data = { | |
key: 314343214, | |
data: { | |
name: 'hello', | |
duration: 44 | |
} |
object-fit: cover (for img) | |
backgroud-size: cover (for url('')) |
absolut path: /images/flower.png relative path: ./images/flower.png (or images/flower.png) or ../../images/flower.png
background-color: #f5f5f5 nice to the eyes nice yellow : #ffc600 or #ffc40e nice gray: #222;
const params = { a: 'foo', b: 'bar' }; | |
const urlParams = new URLSearchParams(Object.entries(params)); | |
fetch('/some/url?' + urlParams); |
function sortListBy(Parameter, List) { | |
return List.sort((a, b) => { | |
if (a[Parameter] > b[Parameter]) { | |
return 1 | |
} else { | |
return -1 | |
} | |
}) | |
} |
const javDetails = detailsList.reduce((acc, detail) => { | |
let key = detail.childNodes[0].textContent | |
let value = detail.childNodes[1].textContent | |
return { ...acc, [key]: value } | |
}, {}) |