0
One of the functions I hate the most is the "Return" because I don’t understand what she does or didn’t do:
var quarter = function(number){
number / 4;
}
if (quarter(12) % 3 === 0 ) {
console.log("A declaração é verdadeira");
} else {
console.log("A declaração é falsa");
}
Well, if they execute this code in Java it occurs that "The Statement is false" 12 being divided by 4 of the quotient 3, is 3 dividing by 3, of the rest 0, which should give "The statement is true" but for a OBSCURE reason gives "The Statement is false". Now we’ll do another test:
var quarter = function(number){
return number / 4;
}
if (quarter(12) % 3 === 0 ) {
console.log("A declaração é verdadeira");
} else {
console.log("A declaração é falsa");
}
If the attentive ones are the ones who will not notice, I put the "Return" before the variable "number", but for ANOTHER OBSCURE REASON , this example, if executed on your computer will give "The Declaration is true"! where in the first example it only gave "The Declaration is false!" as only a function changes something that should or should not happen. I want you to explain how the Return variable works what it does, what it fails to do, ALL its functions are its working examples. Besides telling me why example 1 is 2 are different. I appreciate it if you read it. but I really need your help help PLEASE! I hope to talk in the chat bye <3
return
is an instruction.– Renan Gomes
Renan, but I don’t know what it does, if you read the text carefully, my words demonstrate it. I just wanted to know what it’s for. yes I made a mistake , in considering it a "variable" but, who never made a mistake or will stop making mistakes in life. instead of correcting, why not help?
– BrunoTerroLive Habbo
My goodness, hahaha I just made a comment. In the description of the tag you have marked this question there is some information also: http://answall.com/tags/return/info
– Renan Gomes
Well, I think the questions of stackoverflow do not accuracy the tags to be answered or asked (in source code only lets send questions with tags) but even without tags remains question :)
– BrunoTerroLive Habbo
All right, all right.
– Renan Gomes