Skip to content

console.warn()

Description

The console.warn() method displays an informational message in yellow color to the console, each message is marked with a warning icon. This method is used for pointing out potential problems that are not critical, but need to be fixed. The method can take several arguments and display them on one line.

Syntax

JS
console.warn(message1: any, message2: any, messageN: any) -> void

Parameters

Parameter Type Description
message1 any The text of the message.
message2 any The text of the message.
messageN any The text of the message.

Return value

Type Description
void An empty value.

Example

JS
1
2
3
4
5
6
7
8
9
// One Parameter
console.warn('warn text')

// Multiple Parameters
console.warn('text1', 'text2')
console.warn('text1', 'text2', .. , 'text10')

// Different types of Parameters
console.warn('text1', 123, true, { key: 'value' })
Last update: 14 August 2025, 18:47