We’ve all been there: we’re in that coding flow where code springs from our fingers like lightning bolts. Then we need a method to manipulate an
array, but we’re blanking! So we do some quick Googling, even quicker copy-pasting, run our code, and there it is: a big red error in our console. All because our code was slightly different from the code we copy-pasted.
This article aims to prevent that from happening again by improving your understanding of five commonly used
array methods, their ins and outs (complete with example use cases), and the gotchas to watch out for…
Here’s what we’ll do:
divtag, which will hold a
ptag, which in turn will be our hamburger.
divtag so we know when our user clicks it and toggle the class on our
Assuming you don’t already have a React project up and running, the easiest way to start a new one is to run
npx create-react-app my-app in your command line, wait for the initiation to finish, and then navigate to the new folder of your React app by running
While in the command line, let’s install Three.js. Run
npm install three to install Three.js as a dependency to your project. Before jumping into our code, let’s start our app up by running
npm start. Navigate to
localhost:3000. If everything has gone well we should now see the default start…
Lawyer by day, web developer by night.