let bigObject = { a: 1, b: 2, c: 3, d: 4 }; console.log(bigObject.a); console.log(bigObject.b); console.log('%c' + bigObject.c, 'background: blue; color: white'); console.log(bigObject.d);
It seems that the snippet doesn´t support the console style.
forEach()
loop: let bigObject = { a: 1, b: 2, c: 3, d: 4 }; Object.keys(bigObject).forEach(e => { if (e === 'c') console.log('%c' + e + ": " + bigObject[e], 'background: blue; color: white'); else console.log(e + ": " + bigObject[e]); });
More info at: https://developer.mozilla.org/en-US/docs/Web/API/console#usage
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.