MSK Institute LogoMSK.Institute
HomeCourses
Book Free Demo➔Sign In
Free Demo➔
MSK Institute LogoMSK.Institute

Leading computer training academy in Shikohabad for software engineering, Python, web development, and digital literacy.

ISO 9001:2015 Certified Center
Follow & Connect
4.9

Programs & Admissions

  • All CoursesCatalog
  • Learning PathsRoadmaps
  • Student ProjectsShowcase
  • Live Classes & ScheduleLive
  • Upcoming Batches
  • Campuses & LocationsHub
  • Verify Certificates
  • Book Free Demo Class

Resources & Tools

  • Free Online Mock TestsAll Tests
  • NIELIT CCC Mock TestFree
  • Course & Career FinderQuiz
  • Study Material Hub
  • All MSK ToolsHub
  • Keyboard ShortcutsNew
  • TypeQuest Speed LabTyping
  • MSK Code PlaygroundCode
  • Interactive Tutorials
  • Quick Cheatsheets

Institute & Contact

  • About MSK Institute
  • Careers & InternshipsHiring
  • Publications & Blogs
  • Gali No. 3, Near Gyan Jyoti Public School,
    Adarsh Nagar, Shikohabad, Uttar Pradesh 283135
  • +91 83930 42166
  • mskshikohabad@gmail.com
  • Hours:Mon – Sat: 8:00 AM – 7:00 PM | Sun: 10:00 AM – 2:00 PM
  • 4.9 ★(38 Google Reviews)
© 2026 MSK Institute. All rights reserved.•Privacy Policy•Terms of Service•Disclaimer•Contact Us

Shikohabad's Leading Computer & Coding Academy

Home
Courses
Live
Material
Using console methods0%
Study Materials
JavaScript for IntermediateProgress 0%
1.1Block Scope with let & const1.2Template Literals1.3Destructuring Arrays and Objects1.4Default Parameters1.5Enhanced Object Literals
13.1Using console methods13.2Breakpoints in DevTools13.3Network Tab for API Calls
HomeTutorialsJavaScript for IntermediateUsing console methods
Breakpoints in DevTools

Using console methods

Beginner12 min read•Updated: 2026-09-15•By Er. Sumit Kumar (MSK Institute)
Study Materials

While almost every developer knows console.log(), the browser and Node.js console API provides over 20 specialized methods designed for performance profiling, data tabularization, visual grouping, stack tracing, and assertion verification.


1. Beyond console.log: Informational Levels

Different console levels display with distinct colors, icons, and severity filtering in DevTools:

1console.log('Standard informational message.');
2console.info('Tip / info notice (blue badge in some consoles).');
3console.warn('Warning: API response missing optional field!');
4console.error('Critical Error: Failed to commit transaction!');

2. Visualizing Complex Data: console.table()

When inspecting arrays of objects, console.table() formats the output as an interactive, sortable table:

1const engineers = [
2 { id: 1, name: 'Alice', role: 'DevOps', salary: 110000 },
3 { id: 2, name: 'Bob', role: 'Frontend', salary: 95000 },
4 { id: 3, name: 'Charlie', role: 'Backend', salary: 105000 }
5];
6 
7// Display entire dataset as a table:
8console.table(engineers);
9 
10// Filter table to display specific columns only:
11console.table(engineers, ['name', 'role']);

3. Profiling Performance: console.time() & console.timeEnd()

Accurately benchmark the execution duration of code segments in milliseconds:

1console.time('DataProcessingTimer');
2 
3// Perform compute-intensive logic
4const largeList = Array.from({ length: 1000000 }, (_, i) => i * 2);
5const filtered = largeList.filter(n => n % 3 === 0);
6 
7console.timeEnd('DataProcessingTimer');
8// Logs: DataProcessingTimer: 42.18ms

4. Organizing Logs: console.group() & console.groupCollapsed()

Avoid messy console clutter by grouping related logs into collapsible hierarchies:

1function processOrder(orderId) {
2 console.groupCollapsed(`Order #${orderId} Processing Details`);
3
4 console.log('Validating inventory...');
5 console.log('Checking credit card authorization...');
6 console.log('Packaging warehouse manifest...');
7
8 console.groupEnd();
9}
10 
11processOrder('ORD-991');

5. Assertions & Stack Traces

console.assert()

Logs an error message only if an expression evaluates to false (does not halt execution):

1const userScore = 45;
2// Logs error ONLY if userScore < 50
3console.assert(userScore >= 50, `Score is below passing threshold! Value: ${userScore}`);

console.trace()

Prints the complete call stack trace from where the method was invoked:

1function stepC() { console.trace('Tracing call origin'); }
2function stepB() { stepC(); }
3function stepA() { stepB(); }
4stepA();

Interactive Quiz• Knowledge Check

Practice Quiz

Question 1
Which console method formats an array of objects as a clean, sortable tabular grid in DevTools?
Question 2
What pair of console methods is used to measure how many milliseconds a block of code took to execute?
Question 3
When does console.assert(condition, message) log an error?
Question 4
Which method creates a collapsible group in the DevTools console that starts in a collapsed state?
Question 5
What does console.trace() output?
Next Lesson

Breakpoints in DevTools

Continue learning with hands-on practice, examples, and exercises in the upcoming topic.

Related Lessons

Previous LessonNext Lesson
Generators with function*Breakpoints in DevTools

Practice Quiz

Test your understanding of this lesson with 5 questions. Each question has one correct answer.

Mentor-Led Practical Training

Master JavaScript for Intermediate with Hands-On Projects

Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.

View Full CourseBook Free Demo
PreviousNext
PreviousPrevNext