
console.log(message) 함수는 JavaScript에서 메시지를 콘솔에 출력하는 데 사용됩니다.
이 함수를 사용할 때 message라는 변수는 꼭 필요한 것이 아닙니다. message라는 변수에 값을 할당하지 않아도 콘솔에 아무것도 출력되지 않으면서 함수 자체는 정상적으로 작동합니다.
만약 message라는 변수가 없다면, 콘솔에 아무것도 출력되지 않습니다.
예를 들어, 다음 코드는 콘솔에 "Hello, World!"를 출력합니다.
#hostingforum.kr
javascript
console.log("Hello, World!");
만약 message라는 변수를 사용한다면, 다음과 같이 작성할 수 있습니다.
#hostingforum.kr
javascript
let message = "Hello, World!";
console.log(message);
2025-08-07 06:57