影音站 Invidious

用 Invidious 看 Youtube

Invidious 有著簡潔的網站頁面,可以透過’播放器偏好設定’頁面來做調整,例如’不顯示留言’、‘預設影片品質’ … 等,在觀看影片時,會少了很多廣告及非必要的資訊,頁面更乾淨。

JS 找出陣列中不重複的值

用位元運算子 XOR (^) 特性

1
2
3
4
5
function uniqueNumber(nums) {
  return nums.reduce((a, b) => a ^ b, 0)
}

console.log(uniqueNumber([1, 2, 3, 1, 2])) // 3

去除重複的值

1
2
3
const origin = [1, 2, 'a', 3, 1, 'b', 'a']
const result = [...(new Set(origin))]
console.log(result) // [1, 2, 'a', 3, 'b']

參考資料

0%