Posts by Gustavo Paiva • 173 points
3 posts
-
6
votes1
answer348
viewsQ: Difference between constructor and function that returns literal object
What is the practical difference between me creating a construction function in this way: function construtora (nome, sobrenome) { this.nome = nome this.sobrenome = sobrenome } Or in this way:…
-
6
votes2
answers273
viewsQ: Why does pointing to the same memory address change an object?
If I run the following code: let a = [1, 2, 3] let b = a In this case, the variable 'a' and 'b' are pointing to the same memory address, consequently, everything I change to 'a' will theoretically…
-
4
votes2
answers189
viewsQ: Sum function with a large value returns a wrong result
Why is my summation function returning to me 633223344234234200000 and not 633223344234234234235? function plus(n) { return n+1; } console.log(plus(633223344234234234234))…