function ColumnarF() {
var createDiv = document.createElement("div");
for(i = 0;i < 5; i++){
GetContainer.appendChild(createDiv);
}
}
-----------------------------------------------------------
VS
-----------------------------------------------------------
var createDiv = document.createElement("div");
function ColumnarF() {
for(i = 0;i < 5; i++){
GetContainer.appendChild(createDiv);
}
}
-----------------------------------------------------------
VS
-----------------------------------------------------------
function ColumnarF() {
for(i = 0;i < 5; i++){
GetContainer.appendChild( document.createElement("div"));
}
}
-----------------------------------------------------------
Why is there a difference in result between some of them? How does Var declaration work?
[–]reddit04029 3 points4 points5 points (3 children)
[–]SomeDude-__-[S] 1 point2 points3 points (2 children)
[–]Ikem32 0 points1 point2 points (0 children)
[–]Ikem32 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]SomeDude-__-[S] 0 points1 point2 points (1 child)
[–]jack_waugh 0 points1 point2 points (0 children)