conosle log value undefined?`

textBox.addEventListener("keydown", (event) =>
console.log(`You pressed "${event.key}".`),
);
textBox.addEventListener("keydown", (event) =>
console.log(`You pressed "${event.key}".`),
);
In this case, the value of console.log(), which is undefined, is implicitly returned from the callback function.
source: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Functions What do they mean by conosle log's value being undefined? here coz like it doesnt seem undefined
2 Replies
ἔρως
ἔρως5mo ago
exactly what's written literally the function returns undefined that's it
brr
brrOP5mo ago
but im giving it a string or passing* wait i get it now
let a = console.log("2");
console.log(a);
let a = console.log("2");
console.log(a);
Output:
2 script.js:1:17
undefined script.js:2:9
2 script.js:1:17
undefined script.js:2:9
idk what happened honestly and this has been happnening for years now in every lang lol happens
Want results from more Discord servers?
Add your server