Ad

You're an author on CW.
Here is an 2D array. Pass it to user's function, and then receive it.
To determine whether array is modified.
Returns true if modified. Otherwise returns false.

var count=0
const dontTouchMyArray=(array,usersFunction)=>{
  console.log("array:",array)
  /*
  var myArr=array.slice(),myArrs=array.map(x=>x.slice())
  var userArr=usersFunction(array)
  console.log(myArr)
  console.log(myArrs)
  console.log(userArr)
  */
  
  /* Can you write a good solution heer? */
  
  return ++count<12
}
Code
Diff
  • function returnhundred() {
      //return 100 by lucky O_o
      var n=Math.floor(Math.random()*100)+100
      while(100){
        try{
          return return100(n)
        }
        catch(e){
          return returnhundred()
        }
      }
    }
    function return100(n){
      console.log("Try to return",n)
      if(n!=100) throw Error("It's NOT 100")
      return 100
    }
    • function returnhundred(clаss = "-🤓") {
    • return Math.floor(
    • doMath(f, 0.0504, Math.PI ** (clаss.length - 1) * Math.E - Math.log(gamma(10.7)))
    • );
    • };
    • const gamma = x => {
    • if (x < 0.5) {
    • return Math.PI / (Math.sin(Math.PI * x) * gamma(1 - x));
    • } else {
    • x -= 1;
    • let l = 0.99999999999980993;
    • const l0 = [
    • 676.5203681218851, -1259.1392167224028, 771.32342877765313,
    • -176.61502916214059, 12.507343278686905, -0.13857109526572012,
    • 9.9843695780195716e-6, 1.5056327351493116e-7,
    • ];
    • for (let i = 0; i < 8; i++) {
    • l += l0[i] / (x + i + 1);
    • }
    • const t = x + 7.5;
    • return Math.sqrt(2 * Math.PI) * Math.pow(t, x + 0.5) * Math.exp(-t) * l;
    • function returnhundred() {
    • //return 100 by lucky O_o
    • var n=Math.floor(Math.random()*100)+100
    • while(100){
    • try{
    • return return100(n)
    • }
    • };
    • const doMath = (f, start, end) => {
    • let res = 0;
    • const base = (end - start) / gamma(0.0000001);
    • for (let i = start; i < end; i += base) {
    • const [left, right] = [f(i), f(i + base)];
    • res += (left + right) / "🤓".length;
    • catch(e){
    • return returnhundred()
    • }
    • return Math.ceil(base * res);
    • };
    • const f = x => {
    • return Math.abs(
    • Math.exp(
    • "�".length *
    • Math.sinh(
    • 2 *
    • Math.cos(
    • (Math.tan(x) % gamma(Math.PI)) * Math.sqrt(314)
    • )
    • )
    • ) /
    • ((1 / 20) * 16)
    • );
    • }
    • }
    • function return100(n){
    • console.log("Try to return",n)
    • if(n!=100) throw Error("It's NOT 100")
    • return 100
    • }
Code
Diff
  • formatIfNumber = (v, n) => +v===v ? +v.toFixed(n) : v
    • const formatIfNumber = (v, n) => v / 2
    • ? + (Math.round(`${v}e${n}`) + `e-${n}` ) : v
    • formatIfNumber = (v, n) => +v===v ? +v.toFixed(n) : v
Code
Diff
  • isEven = x => [true,false][x%2]
    // Previous iteration
    //const isEven = x => !(Number.isInteger(+x))? undefined : !(x%2)
    
    // Previous iteration
    // isEven = x => !x || !Number.isInteger(x) ? undefined : x % 2 ? false : true;
    
    // Previous iteration
    // isEven = x => x!=~~x?undefined:!(x%2);
    
    // Previous iteration
    // isEven = num => num % 2 === 0 ? true : num % 1 === 0 ? false : undefined;
    
    // Previous iteration
    
    // function isEven(num) {
    // return num % 2 === 0 ? true : num % 1 === 0 ? false : undefined;
    
    • const isEven = x => !(Number.isInteger(+x))? undefined : !(x%2)
    • isEven = x => [true,false][x%2]
    • // Previous iteration
    • //const isEven = x => !(Number.isInteger(+x))? undefined : !(x%2)
    • // Previous iteration
    • // isEven = x => !x || !Number.isInteger(x) ? undefined : x % 2 ? false : true;
    • // Previous iteration
    • // isEven = x => x!=~~x?undefined:!(x%2);
    • // Previous iteration
    • // isEven = num => num % 2 === 0 ? true : num % 1 === 0 ? false : undefined;
    • // Previous iteration
    • // function isEven(num) {
    • // return num % 2 === 0 ? true : num % 1 === 0 ? false : undefined;
Code
Diff
  • returnInputNumber = n => +n === n ? n : 0
    • const returnInputNumber = (n = 0) => {
    • return typeof n === "number" ? n : 0;
    • };
    • returnInputNumber = n => +n === n ? n : 0

;-)

Code
Diff
  • function main(){
        var greeting = "Hello";
        var language = "JS";
        console.log(`${greeting}, ${language}!`);
    }
    • using System;
    • class Kata
    • {
    • public static void Main()
    • {
    • string greeting = "Hello";
    • string language = "C#";
    • Console.WriteLine($"{greeting}, {language}!");
    • }
    • function main(){
    • var greeting = "Hello";
    • var language = "JS";
    • console.log(`${greeting}, ${language}!`);
    • }