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.
Math.pow(a, b)
Best of the best is COBOL:
(works with numbers, strings... whatever)
I agree with you. the terminoloty is misleading.
the argument contains a reference to a object, u can change the content of the argument, but at end of the function the argument points to the same memory address. in C++ this is more clear, beacause u have the "&" reference operador, then u can pass the address of the argument itself, in this way, u can change the address the argument points.
then, in C++ u can assingn new values for dest and source within the function of the problem.
Thanks for the answers, talk about this things, improve the understading of the subject.
I think we both understand how parameters are passed in JS, we just disagree on the terminology. It sounds silly to me to say that an object is "passed by value" when I can mutate the original object from within the function (i.e. the function has side effects).
Going by your definition, only languages like PHP have something like "passing by reference", where using the assignment operator (
=
) affects the original variable.I think a better term for how objects are passed in JS / Python / Java ... is 'call by sharing'.
If you say that in JS, both
Number
s andObject
s are passed by value, it sounds really misleading with regard to purity and side effects : in one case the function is pure, in the other it's not, and you have to watch out for mutation when you pass your object to a function.Anyway, let's not bicker about it, I dont want to argue endlessly on terminology, as long as we both understand what's happening.
-- deleted
I guess you misunderstand the fact of the passage by reference you pass a reference to parameter, the address of a paramenter, not the address to object pointed, the parameter contain a address for object, but passage by reference pass a reference for a parameter, in this case you can change the paremeter itself.
google it:
"
The parameters, in a function call, are the function's arguments. JavaScript arguments are passed by value: The function only gets to know the values, not the argument's locations. If a function changes an argument's value, it does not change the parameter's original value.
"
you CAN change the object passed to your function precisely because it is passed by reference, not by value ...
Yes, it is the concept of pass by value, we can change the object in memory, but the parameter at the end of function pointers to the same memory address.
Otherwise, by reference, you could change the object pointed and the parameter itself.
are they really ?
objects are passed by a copy of the reference. this means reassigning to the parameter will indeed have no effect on the original object; however, modifying the object's properties will affect the original object
It's a great Kata, I learned alot about JavaScript.
JS parameters are always passed by value, this increase the difficult of the problem, you have to discover a solution for this.
assign values to dest or source does not work within the function.
Wow! beautiful, this is so good!
Congratz, Very classy solution
nice!
this is so beautiful, like o poem.
Beautiful
Loading more items...