What is a state machine? A finite state machine is mathematical model of computation, often used to design algorithms. It describes the behaviour of a system, which is defined in one single state at a time from a finite number of possible states. For...

Markdown supported · ⌘↵ to post
Hello Victoria Lo
Thanks for writing about this topic, I've seen it around and I'll be taught next year about Automata Theory, finite states machines and the likes and I find the concepts behind it pretty interesting, I know, I know some CS stuff 😁
I hope there would be a sequel to this article, where you'll show what you've built using the finite state machine concept.
But while following the article, I noticed you didn't specify how we're to run the js file. I'll show what I did here to get the file running if you don't mind.
import { createMachine, interpret, } from "./node_modules/xstate/dist/xstate.web.js";Both
createMachine&interpretI imported from./node_modules/xstate/dist/xstate.web.jswhich gets created when the commandnpm install xstateis ran. Then I linked the js file is to a HTML file withtype="module"added to thescriptelement attribute.I better way would be to use the CDN. Here's the Doc Page for setting up the CDN.