Join Ray Villalobos for an in-depth discussion in this video Dealing with array ranges, part of Learning CoffeeScript.
…In the same way that CoffeeScript adds capabilities to variables, arrays…get some super powers with the language, namely something called ranges.…So let's take a look.…So creating a basic array is pretty simple, we just type in the…variable name and then some values, so you could do something like this.…You don't have to type in var.…And some of the punctuation, you can take some of these…and put them on separate lines, and that's going to work just fine.…Actually, let me go ahead and put another one in there.…So, you can see, sometimes you can't tell, with the conversion, that…something's happened, so you have to kind of put in an extra number.…
You can see the page kind of refresh sometimes, and that's a clue.…Now, with arrays, you can also do ranges, so you probably know what I mean by that.…So, you can type in something like 1..10, and that…gives you ten numbers, including the 1 and the 10.…If you want to, you can type in an…extra period, and that means don't include this last element.…So you save that, and notice that it goes 1 to 9.…
- What is CoffeeScript?
- Setting up a project with Gulp.js
- Adding CoffeeScript to your workflow
- Dealing with array ranges
- Working with conditional statements
- Using loops
- Working with splats