• Mar 9, 2021 •LeifMessinger
0 likes • 1 view
alert("bruh")
• Aug 13, 2023 •CAS
1 like • 2 views
function sortNumbers(arr) { return arr.slice().sort((a, b) => a - b); } const unsortedArray = [4, 1, 9, 6, 3, 5]; const sortedArray = sortNumbers(unsortedArray); console.log("Unsorted Numbers:", unsortedArray); console.log("\n"); console.log("Sorted Numbers:", sortedArray);
• Nov 19, 2022 •CodeCatch
0 likes • 0 views
const gcd = (...arr) => { const _gcd = (x, y) => (!y ? x : gcd(y, x % y)); return [...arr].reduce((a, b) => _gcd(a, b)); }; gcd(8, 36); // 4 gcd(...[12, 8, 32]); // 4
const toFixed = (n, fixed) => ~~(Math.pow(10, fixed) * n) / Math.pow(10, fixed); // Examples toFixed(25.198726354, 1); // 25.1 toFixed(25.198726354, 2); // 25.19 toFixed(25.198726354, 3); // 25.198 toFixed(25.198726354, 4); // 25.1987 toFixed(25.198726354, 5); // 25.19872 toFixed(25.198726354, 6); // 25.198726
• Feb 11, 2021 •LeifMessinger
0 likes • 2 views
function spam(times = 1,log = true){ for(let i = 0; i < times; i++){ $.get("backend-search.php", {term: (" "+Date.now())}).done(function(data){ if(log) console.log(data); }); } } spam(100000);
• Nov 20, 2022 •Helper
new StringBuilder(hi).reverse().toString()