• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Matt Doyle | Elated Communications

Web and WordPress Development

  • About Me
  • Blog
    • Design & Multimedia
      • Photoshop
      • Paint Shop Pro
      • Video & Audio
    • Online Marketing
      • E-Commerce
      • Social Media
    • Running a Website
      • WordPress
      • Apache
      • UNIX and Linux
      • Using FTP
    • Web Development
      • HTML
      • CSS
      • JavaScript
      • PHP
      • Perl and CGI Scripting
  • Portfolio
  • Contact Me
  • Hire Me
Home / Blog / Articles tagged: for loop

for loop

JavaScript Array Basics

5 May 2008 / 4 Comments

Like most languages, JavaScript lets you create arrays to store bunches of values in. An array is simply a sequence, or list, of values. A value in a JavaScript array can be anything from a number or string, through to a function or an object; JavaScript arrays can store pretty much any type of data. A single value in a JavaScript array is called an element.

With JavaScript arrays, you can:

  • Store any number of values, including no values at all (known as an empty array)
  • Access any or all the elements of an array through a single variable name
  • Read and write elements of an array
  • Loop through all the elements of an array
  • Join two or more arrays together to make one longer array
  • Convert an array to one long string
  • Add or remove elements from the beginning, end, or middle of an array
  • Reverse the order of the elements in an array
  • Sort the elements of an array in any order you like
  • Nest arrays within other arrays

JavaScript stores arrays as Array objects, so most of the things you can do with arrays revolve around the properties and methods of the Array class.

In this introductory article, you look at creating arrays, accessing the contents of arrays, the concept of array lengths, and looping through arrays.

[Read more…] about JavaScript Array Basics

Controlling Program Flow in JavaScript

23 August 2002 / Leave a Comment

One of the key features of all good programming languages is the ability to control the order in which actions are performed. For instance, you may want to run one piece of code if the user has selected a checkbox, but run a different piece of code if they haven’t selected it. Or, you may want to run the same piece of code 10 times (for example, if you’re creating a drop-down list with 10 items).

In this tutorial you’ll learn how to write code to make decisions (e.g. “if the user has selected this checkbox, display this message”), and perform the same action many times (called “looping”).

[Read more…] about Controlling Program Flow in JavaScript

Primary Sidebar

Hire Matt!

Matt Doyle headshot

Need a little help with your website? I have over 20 years of web development experience under my belt. Let’s chat!

Matt Doyle - Codeable Expert Certificate

Hire Me Today

Call Me: +61 2 8006 0622

Stay in Touch!

Subscribe to get a quick email whenever I add new articles, free goodies, or special offers. I won’t spam you.

Subscribe

Recent Posts

  • Make a Rotatable 3D Product Boxshot with Three.js
  • Speed Up Your WordPress Website: 11 Simple Steps to a Faster Site
  • Reboot!
  • Wordfence Tutorial: How to Keep Your WordPress Site Safe from Hackers
  • How to Make Awesome-Looking Images for Your Website

Footer

Contact Matt

  • Email Me
  • Call Me: +61 2 8006 0622

Follow Matt

  • E-mail
  • Facebook
  • GitHub
  • LinkedIn
  • Twitter

Copyright © 1996-2023 Elated Communications. All rights reserved.
Affiliate Disclaimer | Privacy Policy | Terms of Use | Service T&C | Credits