Skip to content

Instantly share code, notes, and snippets.

View hisamparker's full-sized avatar

sam hisamparker

  • utrecht
View GitHub Profile
@hisamparker
hisamparker / spread with Math.max
Created April 10, 2021 19:48
array : return max in an array of nums
let arr = [3, 5, 1];
alert( Math.max(...arr) ); // 5 (spread turns array into a list of arguments)
const uniqueArr = (arr) => {
let newArr = [];
newArr = arr.filter((element) => arr.indexOf(element) === arr.lastIndexOf(element));
console.log(newArr);
return newArr[0];
};
@hisamparker
hisamparker / arrayMethods
Created April 8, 2021 07:32
array : remove dulicates
//const array = [1, 3, 2, 3, 2, 1, true, false, true, 'Kio', 2, 3];
const filteredArray = [...new Set(array)];
//console.log(filteredArray) // [1, 3, 2, true, false, "Kio"]

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units