🚀 Understanding console.log() in JavaScript console.log() is one of the most basic and important methods in JavaScript. It is mainly used to print messages, values, or variables in the browser console. 🔹 What is console.log()? • A method used to display output in the browser’s console • Helps developers understand how the code is working • Very useful for debugging and testing code 🔹 Why is console.log() important? • Helps track values of variables • Makes debugging easier • Useful for beginners to understand program flow • Commonly used during development 💡 Example uses: • Printing messages • Checking variable values • Debugging errors • Understanding logic step by step 📚 Today, I learned about console.log() as part of my JavaScript learning journey. More concepts coming soon! 😊 #JavaScript #ConsoleLog #WebDevelopment #LearningJourney #Beginner #Frontend #Coding
Understanding console.log() in JavaScript
More Relevant Posts
-
Have you ever done this in JavaScript? 🤨 console.log(x); // no error var x = 5; console.log(y); // ❌ ReferenceError let y = 10; Feels weird, right? 😅 Here’s the real reason 👇 JavaScript creates memory for all variables before execution starts. But it treats them differently: ✅ var gets hoisted and initialized to undefined, so accessing it before declaration just prints undefined. ⚠️ let (and const) are also hoisted, but NOT initialized. They live in a temporary dead zone until the declaration line is reached - so trying to use them early throws a ReferenceError. In simple terms: this is hoisting - but only var gets a default value upfront. 💡 If you’re learning JavaScript fundamentals, mastering this will save you from tons of weird bugs. 👇 Comment “HOISTED” and I’ll drop quick interview questions on hoisting! #JavaScript #WebDevelopment #JSTips #Coding #Tech
To view or add a comment, sign in
-
-
🚀 30 Days of JavaScript – Day 4 Continuing my journey to improve JavaScript logical thinking by building small programs every day. 💡 Today’s Program: Vowel Identifier & Replacement This program: i) Takes a name as input ii) Identifies vowels (a, e, i, o, u) iii) Replaces vowels with * iv) Counts the total number of vowels in the name 🧠 Concepts Used: prompt() for user input for loop for iteration toLowerCase() for case handling includes() method Conditional logic (if / else) Example: Input → john Output → j*hn Total Vowels → 1 🎥 Demo below 👇 Full source code in the first comment. #JavaScript #WebDevelopment #CodingJourney #ProblemSolving #LearningJavaScript #30DaysOfCode
To view or add a comment, sign in
-
Today I built a small JavaScript project where: ✅ Multiple buttons perform different actions ✅ Used forEach to handle events ✅ Created <p> dynamically using JS ✅ Worked with prompt() inputs ✅ Applied arrow functions ✅ Used Date().getFullYear() ✅ Practiced DOM manipulation Each button does something unique, like 👉 Taking user input 👉 Performing calculations 👉 Showing current year 👉 Combining first & last name 👉 Clearing output Slowly improving my JavaScript logic and real-world thinking 💪 #JavaScript #WebDevelopment #FrontendDeveloper #LearningInPublic #CodingJourney #DOM #SheiyansCodingSchool #Kodex
To view or add a comment, sign in
-
-
I created a JavaScript mini project to explain hoisting, scope, array methods, and async JS with interactive examples. GitHub:https://lnkd.in/grA_usbK Live: https://lnkd.in/gCBnqSPm #JavaScript #Coding #Project
To view or add a comment, sign in
-
🚀 Just Published My New Blog! I’ve written a beginner-friendly guide on Control Flow in JavaScript — covering: ✅ What control flow means ✅ if statement ✅ if-else statement ✅ else-if ladder ✅ switch statement If you're learning JavaScript, this will help you understand decision-making in code clearly. 🔗 Read here: https://lnkd.in/d9RNEYNy Feedback is always welcome! 🙌 #JavaScript Hitesh Choudhary Piyush Garg Akash Kadlag Jay Kadlag Anirudh Jwala Chai Aur Code
To view or add a comment, sign in
-
JavaScript does NOT use classical inheritance. It uses Prototype inheritance. Example: function Person(name) { this.name = name; } Person.prototype.sayHi = function() { console.log("Hi " + this.name); }; const p1 = new Person("Prakhar"); p1.sayHi(); How it works: JavaScript creates empty object Links it to Person.prototype Assigns this Returns object If property not found on object, JavaScript looks up the prototype chain. This is how inheritance works internally. Understanding prototypes makes debugging easier. #javascript #webdevelopment #frontend #programming
To view or add a comment, sign in
-
🎮 Built a Mini JavaScript Game – Catch the Cheese After learning basics, I challenged myself to build a small game using pure HTML, CSS & JavaScript. 🧠 Concepts I applied: • Game logic • Event listeners • Score tracking • Timers This project improved my problem-solving skills and logical thinking. GitHub: https://lnkd.in/dfSfNZCd Live demo: https://lnkd.in/d6R2zGv5 #JavaScript #FrontendDeveloper #CodingJourney
To view or add a comment, sign in
-
JavaScript behavior that looks completely wrong: console.log([] + []); Output: "" Why? Because + triggers type coercion. Step 1: Both arrays are converted to primitive values. [].toString() → "" Step 2: Now it becomes: "" + "" Which equals: "" Now look at this: console.log([] + {}); Output: "[object Object]" Why? [].toString() → "" {}.toString() → "[object Object]" So it becomes: "" + "[object Object]" Understanding coercion rules prevents unpredictable bugs. JavaScript is simple. Its edge cases are not. #javascript #webdevelopment #programming #frontend #softwareengineering
To view or add a comment, sign in
-
💡 JavaScript Tip: slice() vs splice() Many beginners get confused between slice() and splice(). Here’s a simple example to understand the difference. Code 👇 let arr = [1,2,3,4] let a = arr.slice(1,3) let b = arr.splice(1,3) console.log(arr) console.log(a) console.log(b) 🔎 What happens here? • slice() → Creates a new array and does NOT change the original array. • splice() → Changes the original array and returns the removed elements. 📌 Output arr → [1] a → [2,3] b → [2,3,4] Understanding small differences like this helps a lot in JavaScript interviews and real projects. #javascript #webdevelopment #coding #programming #frontenddeveloper #100daysofcode
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development