37 lines
765 B
TypeScript
37 lines
765 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');
|
|
|
|
// function divide(a, b) {
|
|
// return a / b;
|
|
// }
|
|
|
|
// console.log(divide(10)); // Expected 2 arguments, but got 1.
|
|
}
|