Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
same solution but i use match() instead.
wao, i barely servived the critisism, but thanks for correcting my regExp mistake.
Yes, the use of assignment here is a little bit confusing.
Although it is worth noting, that it is not enough to just change
+=
to+
, because the order of operations will be different. There should be parentheses to enclose the second part. That suggests me to believe, that the+=
operator was used here to omit using parens.There is also no need to assign the new value to the
name
variable with+=
. Return it without assignment,return name + ...
.This comment is hidden because it contains spoiler information about the solution
mine is more clear and a bit close to you.
Got it, thanks =)
Yes! Using the prototype you only have one function that's shared by all the instances. If you define it inside the function, you're doing extra work and having multiple instances of that method in memory if you have multiple instances of the Person
Edit: so yes, it's faster and consumers less memory when you have multiple instances
No I know, I meant is there a benefit from defining the method outside the function constructor, instead of writing it inside it as
this.greet=function(){...};
?Prototypes! This is how you originally did "methods" in JavaScript before there was classes. Classes are in fact just built on top of prototypes
Why write the method outside the constructor function?
Wonderful implementation of the zip function.
"It can lead to bugs that are difficult to spot."
But the exact circumstances where automatic semicolon insertion doesn't behave as one would desire is clear and well-behaved. It's not black magic as everyone is instructed to believe as if. Just like every other tools, use your tools improperly and you get bitten in the back. (e.g defining RegExp objects with global flag then use them repeated to test different strings)
Recommended reading:
http://inimino.org/~inimino/blog/javascript_semicolons
Also the negative cases of 90.0001 and 180.0001.
Added
Loading more items...