From the course: Learning CoffeeScript
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Dealing with array ranges - CoffeeScript Tutorial
From the course: Learning CoffeeScript
Dealing with array ranges
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Basic CoffeeScript syntax7m 15s
-
(Locked)
Using realistic assets5m 24s
-
(Locked)
Understanding variables10m 11s
-
(Locked)
Dealing with array ranges4m
-
(Locked)
Working with conditional statements5m 2s
-
(Locked)
Using loops and comprehensions4m 14s
-
(Locked)
Adding basic functions2m 57s
-
(Locked)
Working with splats3m 28s
-
(Locked)
Using the switch statement2m 51s
-
(Locked)
Using aliases for "this" and other tidbits3m 57s
-
(Locked)
-