log method

Sends a log "message" to the console. The message is prefaced by the string "LOG".


Console.log(message, optionalParams);


  • message [in]
    Type: DOMString

    The message to display.

  • optionalParams [in]
    Type: any

    A value or string that can be used with replaceable parameters in the main message.

Return value

This method does not return a value.


The optional parameters can be used to provide a replaceable value in the message. For example, you could include a specific message to log as the optional parameter, rather than building a string by concatenating the logging message to the message string.

  function sendLogConsole(logMsg) {
        window.console.log("%s was logged", logMsg);

See also