Skip to content

Instantly share code, notes, and snippets.

@Giayychan
Giayychan / format.js
Last active April 27, 2020 06:21
for $
export function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
@Giayychan
Giayychan / object.value.js
Created April 27, 2020 04:46
return an array containing the given object's own enumerable property values.
const object1 = {
a: 'somestring',
b: 42,
c: false
};
console.log(Object.values(object1));
// expected output: Array ["somestring", 42, false]