One of the functions I hate the most is "return" because I do not understand what it does or does not do, I'll give you an example:
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 you run this code in javaScript it happens that "The statement is false" being that 12 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 an obscure reason it gives" The Declaration 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 are those who will not notice, I put the "return" before the variable "number", but for ANY OTHER REASON, this example, if it is executed on your computer it will give "The Declaration is true"! being that in the first example it only gave "The Declaration is false!", as only one function changes something that should or should not happen. I want you to explain how the variable returns what it does, what it fails to do, ALL its functions are its working examples. In addition to telling me the reason for example 1 is 2 are different. I thank you if you read. but I really need your help to help me PLEASE! I hope to speak in chat bye