Files
JS/07_js-debug/faq/reference-error.ts
T
2026-11-02 11:17:53 +01:00

31 lines
640 B
TypeScript

{
const firstName = 'John';
// if (firstName === John) {
// // ReferenceError: John is not defined
// console.log(firstName);
// }
// if (firstname === 'John') {
// // Uncaught ReferenceError: firstname is not defined
// console.log(firstName);
// }
if (firstName === 'John') {
console.log(firstName);
}
function greet() {
console.log('Hello, ' + fullName); // Cannot find name 'fullName'.
console.log(typeof fullName);
}
// greet(); // => ReferenceError: fullName is not defined
// function greet(fullName) {
// console.log(`Hello, ${fullName}`);
// }
greet('John Wick');
}