HTML DOM console.info() 方法

定义和用法

console.info() 方法向控制台写入消息。

提示:当测试控制台方法时,请确保控制台视图可见(按 F12 查看控制台)。

实例

例子 1

向控制台写入消息:

console.info("Hello world!");

亲自试一试

例子 2

使用对象作为消息:

var myObj = { firstname : "Bill", lastname : "Gates" };
console.info(myObj);

亲自试一试

例子 3

使用数组作为消息:

var myArr = ["Orange", "Banana", "Mango", "Kiwi" ];
console.info(myObj);

亲自试一试

语法

console.info(message)

参数值

参数 类型 描述
message String or object Required. Write a message or object to the console.

Browser support

The numbers in the table indicate the first browser version that fully supports this method.

Method Chrome IE Firefox Safari Opera
console.info() Support 8.0 4.0 Support Support