The programmers way of creating a shopping list – Arrays!

Uncategorized

js shopping basket.png

 

So using the developers options in Google chrome I decided to create my list of necessary grocery items – I live and love programming so I usually do this, and thought I would take the time to share this with you… It’s a little nerdy but I love it and I reckon it’s the cool way of standing out in the milk aisle. The image you see above is a JS shopping basket.

Step by step process below… (nothing confusing – straight forward basic JavaScript).

 

devtools.jpg

So what you want to do is head over to Google Chrome and click on the three small dots on the top right corner and you should see a drop down menu like the image above and then, go down to tools – developer tools and hit ‘enter’.

 

 

Then type in the following – changing whatever items you want and you have created an array of things you will need and below I’ll explain how this works.

codeJS.png

So the first thing we do (because we are a team) is create a variable – think of a variable as a container). We call this variable myList, now the computer knows, right, I have a container which is identified to me as ‘myList’. Brilliant. Now, we want the computer to know what exactly goes in that list, which we will then input an array of things; an array is just a series of items, numbers or names in one place that appear all together when the computer is prompted to. That is it, we let the computer know that is the end of that command by placing ‘;’ one of these at the end of the closing brackets.

Now it may not look that pretty and appealing now, but think about what applications, web apps you could build with just understanding the basics.

Don’t listen to those people out there that say programming is hard – it really isn’t it’s easy.

Have fun guys!

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s