9 [file] One-Liners You Should Know
April 16, 2022
9:50 AM
[link]
1. Shuffle Around Values in an Array
constshuffleArray =(arr)=>arr.sort(()=>0.5-Math.random());
let myarray =Array.from({length:52},(v,k)=>k+1);console.log(shuffleArray(myarray));
Check if a Date Is on a Weekend or Weekday
constisWeekend =(date)=>date.getDay()%6==0;
constisWeekday =(date)=>date.getDay()%6!==0;