Join Ray Villalobos for an in-depth discussion in this video Using aliases for "this" and other tidbits, part of Up and Running with CoffeeScript.
…Now cofeescript has a lot of other different ways that it tries to help you.…So I'm going to talk about some of these in here.…One of them is that it provides you with an alias for an argument called this.…and it's pretty awesome.…So let me explain about this a little bit.…When a function is invoked, it gets two special parameters assigned to it.…You may already know that functions come with an arguments parameter.…That argument allows you to list all the items that…were passed to the function, and it could be pretty useful.…Well, in addition to that, every function also gets a this…argument, and it's supposed to let you access the current object.…
Normally, you would expect This to refer to the function that you're using.…But in a lot of instances, it returns the wrong thing.…So, it really makes more sense if I show it to you.…Let go ahead and create a new function here.…We'll call it fill and it'll take item.…And we'll use a CoffeeScript arrow to execute this function.…I'm going to use J query content selector, and just append.…
- 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