กลุ่มคอนโซล ()
ตัวอย่าง
สร้างกลุ่มข้อความในคอนโซล:
console.log("Hello world!");
console.group();
console.log("Hello again,
this time inside a group!");
ตัวอย่างเพิ่มเติมด้านล่าง
ความหมายและการใช้งาน
วิธี การgroup()
เริ่มกลุ่มข้อความ
ข้อความใหม่ทั้งหมดจะถูกเขียนในกลุ่มนี้
ไวยากรณ์
console.group(label)
พารามิเตอร์
Parameter | Description |
label | Optional. A label for the group |
ตัวอย่างเพิ่มเติม
จบกลุ่มด้วย console.groupEnd():
console.log("Hello world!");
console.group();
console.log("Hello again,
this time inside a group!");
console.groupEnd();
console.log("and we
are back.");
ระบุป้ายกำกับสำหรับกลุ่ม:
console.log("Hello world!");
console.group("myLabel");
console.log("Hello again,
this time inside a group, with a label!");
รองรับเบราว์เซอร์
console.group()
ได้รับการสนับสนุนในเบราว์เซอร์ที่ทันสมัยทั้งหมด:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | 11 | Yes | Yes | Yes | Yes |