I'm trying to complete The Odin Project and saw an interesting console error
function repeat(string, number) {
var finalst;
for (i = 0; i < number; i++) {
finalst += string;
}
return finalst;
}
console.log(repeat("hey", 3));
The result in console is "undefinedheyheyhey". How is it showing like that and why ?