• BluePower
    link
    English
    2
    edit-2
    27 days ago

    Also fun fact, lists on Perchance are actually made of custom objects, and so every single type of JavaScript objects is treated by the Perchance engine as “lists”. And since arrays are of objects, evaluating them directly will output a random item from the array, as if they’re lists, if you don’t know yet.

    In addition, [ ({}) ] and [ [{}] ] gives the same result as e = [ x = {} ].

    • @[email protected]OP
      link
      fedilink
      English
      227 days ago

      Ah yes, I’ve seen perchance is everywhere… which is cool sometimes, unless you don’t want it to be perchancing and then it’s a bloomin’ nightmare. 🤣 And if you know JS as I do, and come in here thinking you can do easy things… you’re probably going to bash your head against a brick wall from time to time until you can hack your way around it!

      I could see why [({})] returns the same value as [x={}]. Shouldn’t [[{}]] return an array though? Or do you just mean in terms of it perchancing it so it gives you one of the array items at random and there’s only one array item so it (eventually evaluates to) the same thing?