29
loading...
This website collects cookies to deliver better user experience
console.log
console.info
console.error
console.warn
let peoples = [
{
name: "Richard Hendricks",
location: "Berkely",
cell: "4254-024-8162",
age: 32,
},
{
name: "Christiansen Frederikke",
location: "Madras",
cell: "4987-024-2562",
age: 34,
},
{
name: "John Doe",
location: "California",
cell: "3143-344-342",
age: 53,
},
];
console.table(peoples);
const title = "Me and my boys";
console.group(title);
console.table(peoples[0]);
console.info("Weather is very beautiful today ☁");
console.warn("Don't fall for the beautiful weather");
console.groupEnd(title);
console.groupCollapsed()
to have the logs closed by default.console.time()
.console.time();
Array.from(new Array(400)).forEach(_ => console.log("Zzzz!"));
console.timeEnd();
label
to distinguish between different counters. To stop one from counting above, you've to use console.countReset(label)
.console.count("Awesome"); // Awesome: 1
console.count("Awesome"); // Awesome: 2
console.count("Awesome"); // Awesome: 3
console.count("Awesome"); // Awesome: 4
console.countReset("Awesome");
console.count("Awesome"); // Awesome: 1
console.log(
"%s, told me that we're going to mall today with %s",
"Alan",
"Mike"
);
// Alan, told me that we're going to mall today with Mike
console.log("We had %i mangoes today", 56);
// We had 56 mangoes today
console.log(
"Did you know, Tesla Model S can reach 0 to 60 mph in %f seconds?",
2.3
);
// Did you know, Tesla Model S can reach 0 to 60 mph in 2.3 seconds?
;
does the trick.console.log(
"%cThis is actually very interesting",
"color: yellow; font-size: 35px; background-color: red;"
);
console.log(
"%cThis is actually %cvery interesting",
"color: blue; font-size: 55px; background-color: yellow;",
"font-size: 55px; background-color: blue; color: yellow"
);
let blackBackground = [
"font-size: 50px",
"background-color: black",
"color: white",
].join(" ;");
let whiteBackground = [
"font-size: 50px",
"background-color: white",
"color: black",
].join(" ;");
console.log(
"%cAwesome stuff is %ccoming your way",
blackBackground,
whiteBackground
);
let backgroundImage = [
"background-image: url(https://source.unsplash.com/random/1200x800)",
"background-size: cover",
"color: hotpink",
"padding: 100px",
"font-weight: bold",
"font-size: 25px",
].join(" ;");
console.log("%cPicture says a thousand words", backgroundImage);
let backgroundImage = [
"background-image: url(https://i.pinimg.com/originals/5b/43/02/5b4302c2f6413454c782aeec866143cf.gif)",
"background-size: cover",
"color: black",
"padding: 100px",
"font-weight: bolder",
"font-size: 40px",
"-webkit-text-stroke-width: 1px",
"-webkit-text-stroke-color: yellow",
"text-transform: uppercase",
"text-align: center",
"letter-spacing: 1px",
].join(" ;");
console.log("%cMay the force be with you", backgroundImage);