let a;
console.log(typeof a); // 출력: "undefined"

console.log(typeof true); // 출력: "boolean"
console.log(typeof 42); // 출력: "number"
console.log(typeof "Hello"); // 출력: "string"
typeof operand // operand는 피연산자를 의미함
let x = 42;
let y = "Hello";
let z = {key: "value"};

console.log(typeof x); // 출력: "number"
console.log(typeof y); // 출력: "string"
console.log(typeof z); // 출력: "object"
/* Numbers */
typeof 24 === "number"
typeof 3.14 === "number"
typeof NaN === "number"

typeof parseInt("10px") === "number"
typeof Number("2") === "number"  
typeof Number("글자") === "number" 

/* Strings */
typeof "코딩" === "string"
typeof "" === "string"
typeof `template literal` === "string"
typeof "24" === "string"
typeof String(24) === "string"

/* Booleans */
typeof true === "boolean"
typeof false === "boolean"
typeof Boolean(24) === "boolean"

typeof !!24 === "boolean" // 부정(not)을 의미하는 !을 두 번 호출하면 Boolean()과 동일합니다.

/* Undefined */
var x;
typeof x === "undefined";
typeof undefined === "undefined";

typeof y === "undefined"; // 선언하지 않은 변수도 "undefined"를 반환

/* Objects */
typeof {param: 1} === "object";
typeof {} === "object";

typeof [1, 2, 3] === "object"; // 배열도 "object"를 반환
typeof [] === "object"; // 빈 배열도 "object"를 반환

typeof /regex/ === "object"; // 정규식 표현식도 "object"를 반환

typeof null === "object" // null도 "object"를 반환

/* Functions */
function $() {}
typeof $ === "function";

typeof function () {} === "function";
typeof class ClassName {} === "function";

/* Symbols */
typeof Symbol() === "symbol";
typeof Symbol("foo") === "symbol";

/* BigInts */
typeof 1n === "bigint";
typeof BigInt("1") === "bigint";
console.log(typeof null); // 출력: "object"
let regex = /[a-zA-Z]/;
console.log(typeof regex); // 출력: "object"
const arr = [1, 2, 3];
console.log(typeof arr); // 출력: "object"
const arr = [1, 2, 3];
console.log(Array.isArray(arr)); // true
// x를 선언한 적이 없음
console.log(typeof x); // "undefined"
/* 값이 할당되지 않은 변수 x */
let x;

if (x === undefined) {
    console.log("true로 평가됩니다.");
} else {
    console.log("false로 평가됩니다.");
}
// 출력: "true로 평가됩니다."

/* 선언되지 않은 변수 y */
try {
    y; // 변수에 접근 시도
    console.log('변수가 선언되었습니다.');
} catch (error) {
    console.log('변수가 선언되지 않았습니다.'); 
}
// 출력: "변수가 선언되지 않았습니다."
if (typeof jQuery === "function") {
    console.log("jQuery가 로드되어 사용 가능합니다.");
} else {
    console.log("jQuery가 로드되지 않았습니다.");
}