DEV Community

loading...

doYoda() => {...}

☮️✝️☪️🕉☸️✡️☯️
Linux girl, gamer, and programmer. <3 Math, Graphics, Art, Techno, & Blackholes. My heroes are Einstein, Hawkin, and Sagan. If i could have any superpower, it would be the ability to control time.
・1 min read

Alt Text

doYoda() {
    let doOr = (10 * Math.random()).toFixed(0),
      doNot = (10 * Math.random()) % 2 > 1,
      thereIsNoTry = [
        "Do or do not. There is no try.",
        "You must unlearn what you have learned.",
        "Named must be your fear before banish it you can.",
        "Fear is the path to the dark side.",
        "That is why you fail.",
        "The greatest teacher, failure is.",
        "Pass on what you have learned.",
        "Now I know there is something strong than fear — far stronger.",
        "Don't underestimate the Force.",
        "For my ally is the Force, and a powerful ally it is."
      ];

    if(doNot) {
      this.strings.push({
        name: "yoda",
        time: "NOW",
        text: [thereIsNoTry[doOr]]
      });
      this.forceUpdate(() => {
        /* spaghetti && meatballs */
      });
    }
  }
Enter fullscreen mode Exit fullscreen mode

Fun little script i use instead of lorem... maybe a fun npm module if someone wants to own it.

:)

If you found this helpful or useful, please share a 💓, 🦄, or 🔖. Thanks!

Discussion (1)

Collapse
miketalbot profile image
Mike Talbot

I am totally borrowing that haha