[...arr.join("")]
...
[...arr.join("")]
...
parseInt(二進位數字或字串,2)
...
(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)|(^-?0{1}$)
function numArr(num) {
return [...new Array(num).keys()].map(el=>`${el+1}`);
}
回傳偶數陣列:
function evenNumbers(array, number) {
return array.filter((el) => !(el & 1))
}
回傳奇數陣列:
function evenNumbers(array, number) {
return array.filter((el) => (el & 1))
}
...
語法(簡單):
var newArray = 原始陣列.filter(callback[, thisArg])
...
(這個最快)
let newDate = Math.floor(new Date() /1000) //取得timestamp
let dates = new Date(newDate * 1000) //將上面的timestamp還原為時間格式
...
toLocaleString('地區名',{格式放於此})
...
使用Object.defineProperty()
(writable設為false即可)
物件陣列.forEach(function(el){ el.屬性名稱=屬性值; });
javascript:(function() { function R(a){ona = "on"+a; if(window.addEventListener) window.addEventListener(a, function (e) { for(var n=e.originalTarget; n; n=n.parentNode) n[ona]=null; }, true); window[ona]=null; document[ona]=null; if(document.body) document.body[ona]=null; } R("contextmenu"); R("click"); R("mousedown"); R("mouseup"); R("selectstart");})()
...