hyshai + javascript   68

jQuery Fundamentals :: JavaScript Basics
Object methods

Methods of an object are just properties whose values are functions. Let's add a .greet() method to our person object:

var person = {
firstName : 'Boaz',
lastName : 'Sender',
greet : function(name) {
log( 'Hi, ' + name );
}
};

person.greet( person.firstName );
The .greet() method in the example above received a string, name, as its argument. When we called the method, though, we simply passed in the value of the firstName property of the person object. If we wanted a super-flexible .greet() method that could greet anyone, this might be what we want. But it probably makes more sense that the .greet() method will greet the particular person.

The meaning of this

Inside of a method — indeed, inside of any function — there is a special keyword available to us: this. It refers to the object that is the context in which the function was called.

When we call person.greet(), the context object is person itself. This means that we can use this to access a property of the person object from directly within the .greet() method.

The meaning of this can be incredibly perplexing to new JavaScript developers, and you should take comfort in knowing that jQuery largely makes it so that you don't need to understand it for a while. However, no disc
javascript  tutorial 
march 2017 by hyshai
ember-cli/CHANGELOG.md at master · stefanpenner/ember-cli · GitHub
new ember-cli version v0.0.28
change log:

npm install -g ember-cli

try it out & report bugs/annoyances
emberjs  javascript  from twitter_favs
may 2014 by hyshai
iTransmogrify!
iTransmogrify! is a bookmarklet for iPhone which transforms embedded Flash content into direct links to natively supported formats.
javascript  from pocket
march 2012 by hyshai

Copy this bookmark:



description:


tags: