I recently published a blog on “Understanding Variables and Data Types in JavaScript.” For many beginners, JavaScript frameworks look exciting, but the real strength of a developer comes from strong fundamentals. In this blog, I explain: 1. What variables are and why they are needed 2. How to declare variables using var, let, and const 3. Primitive data types (string, number, Boolean, null, undefined) 4. Basic difference between var, let, and const 5. What is scope (very beginner-friendly explanation) If you're starting your web development journey, mastering these basics will make learning advanced concepts much easier. Read the blog here: https://lnkd.in/gkA-AmYj #JavaScript #WebDevelopment #Programming #LearnToCode #SoftwareDevelopment #chaiCodeCohort Hitesh Choudhary Akash Kadlag
Mastering JavaScript Fundamentals: Variables and Data Types
More Relevant Posts
-
𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗔𝗿𝗿𝗮𝘆𝘀 𝟭𝟬𝟭 You often need to store multiple values together when working with JavaScript. For example, you might want to store: - A list of fruits - Student marks - A list of tasks Instead of creating many separate variables, JavaScript provides a better solution called arrays. Arrays help you store and manage collections of data efficiently. You will learn the basics of arrays in JavaScript and how to work with them. You will learn: - What arrays are and why you need them - How to create an array - Accessing elements using an index - Updating elements in an array - The length property - Looping through arrays An array is a data structure that stores multiple values in a single variable. The values inside an array are stored in a specific order, and each value can be accessed using its index. For example, let fruits = ["Apple", "Banana", "Orange"]; You can store different data types in an array, like let data = ["John", 25, true]. Each element in an array has a position called an index. In JavaScript, array indexing starts from 0. You can access elements using their index, like console.log(fruits[0]); You can change any value in an array by using its index, like fruits[1] = "Mango". The length property tells you how many elements are inside the array, like console.log(fruits.length); You can loop through arrays using a for loop, like for (let i = 0; i < fruits.length; i++) { console.log(fruits[i]); } Source: https://lnkd.in/gyY3cNir
To view or add a comment, sign in
-
𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗔𝗿𝗿𝗮𝘆𝘀 𝟭𝟬𝟭 You often need to store multiple values together when working with JavaScript. For example, you might want to store: - A list of fruits - Student marks - A list of tasks Instead of creating many separate variables, JavaScript provides a better solution called arrays. Arrays help you store and manage collections of data efficiently. You will learn the basics of arrays in JavaScript and how to work with them. You will learn: - What arrays are and why you need them - How to create an array - Accessing elements using an index - Updating elements in an array - The length property - Looping through arrays An array is a data structure that stores multiple values in a single variable. The values inside an array are stored in a specific order, and each value can be accessed using its index. For example, let fruits = ["Apple", "Banana", "Orange"]; You can store different data types in an array, like let data = ["John", 25, true]. Each element in an array has a position called an index. In JavaScript, array indexing starts from 0. You can access elements using their index, like console.log(fruits[0]); You can change any value in an array by using its index, like fruits[1] = "Mango". The length property tells you how many elements are inside the array, like console.log(fruits.length); You can loop through arrays using a for loop, like for (let i = 0; i < fruits.length; i++) { console.log(fruits[i]); } Arrays help you store multiple values in one place, access elements using indexes, and easily loop through data. Source: https://lnkd.in/gyY3cNir
To view or add a comment, sign in
-
Many developers who start learning JavaScript often get confused about when to use LocalStorage and SessionStorage. Both allow you to store data in the browser, but their behavior is quite different. LocalStorage Data remains even after the browser is closed Useful for storing user preferences, themes, or saved settings SessionStorage Data is cleared when the browser tab is closed Useful for temporary session data Understanding this small but important difference can improve how you manage client-side data in your web applications. I have explained the concept with examples in my latest tutorial: 👉 LocalStorage vs SessionStorage in JavaScript Read the full article here: https://lnkd.in/grQYnN-E #JavaScript #FrontendDevelopment #WebDevelopment #Programming #Coding
To view or add a comment, sign in
-
Every JavaScript developer has shipped this bug: async function processStream(response) { const reader = response.body.getReader() while (true) { const { done, value } = await reader.read() if (done) break processChunk(value) // ← throws an error } reader.releaseLock() // ← never reached. Stream locked forever. } The fix? A try...finally block you have to remember to write every single time. ES2026's using keyword makes this class of bug impossible. 🔒 using readerResource = { reader: response.body.getReader(), [Symbol.dispose]() { this.reader.releaseLock() } } // releaseLock() called automatically — even if processChunk throws Add [Symbol.dispose]() to any class, and using guarantees cleanup when scope exits — on return, on break, or on error. For async resources, await using + [Symbol.asyncDispose] handles it: await using redis = new RedisClient(config) // redis.quit() runs automatically when scope exits The proposal also ships: → DisposableStack — manage multiple resources, disposed LIFO → SuppressedError — preserves both errors if cleanup itself throws → Works in for loops — dispose at end of each iteration TypeScript has supported it since 5.2. Chrome 134+, Firefox 134+, Node.js 22+. Babel transpiles it for older targets. I wrote the complete guide for DB connections, transactions, streams, WebSockets, mutexes, perf timers, and DisposableStack patterns. Have you started using this yet? 👇 #JavaScript #ES2026 #WebDev #NodeJS #Programming #100DaysOfBlogging
To view or add a comment, sign in
-
🚀 JavaScript Day 2 – Deep Understanding of Core Concepts Today I focused on understanding each concept in detail with definitions and clarity 💻🔥 📌 Topics & Definitions: 🌐 Origin of JavaScript JavaScript was created in 1995 by Brendan Eich to make web pages interactive. 📝 Variables Declaration Variables are used to store data values using let, var, or const. 🔒 Constants Declaration Constants (const) store values that cannot be reassigned after declaration. ⚠️ Old Method: var var is the old way of declaring variables, function-scoped and can cause issues. ❌ Problems with var No block scope Can be redeclared Causes bugs due to hoisting 🔑 let vs const let → value can change const → value cannot change 📊 Data Types in JavaScript 👉 Primitive Data Types (Immutable) Number 🔢 → Stores numeric values String 🧵 → Stores text Boolean ✅❌ → true/false values Undefined ❓ → Variable declared but not assigned Null ⚪ → Intentional empty value BigInt 💡 → Large integers beyond Number limit Symbol 🔐 → Unique identifier 👉 Non-Primitive Data Types (Mutable) Array 📦 → Collection of values Object 🧱 → Key-value pairs Function ⚙️ → Reusable block of code 🧠 Important Concepts: 🔍 Null vs Undefined undefined → value not assigned null → intentionally empty ⚙️ typeof Operator Used to check data type of a value 🤯 typeof null Bug typeof null returns "object" (this is a known JavaScript bug) 🔒 Immutability (Primitive) Primitive values cannot be changed directly 🔄 Mutability (Non-Primitive) Objects & arrays can be modified 📥 Pass by Value Primitive values are copied when assigned 🔗 Pass by Reference Objects are assigned by reference (memory address) 💡 Why Pass by Reference? To save memory and improve performance 📅 Day 2 Complete ✔️ Building strong fundamentals step by step 💪 #JavaScript #LearningJourney #Day2 #Coding #WebDevelopment #Programming #Developer
To view or add a comment, sign in
-
-
JavaScript has had a broken date API for 30 years. This week, after a 9-year standardization effort, Temporal finally reached Stage 4 — meaning it will ship in ECMAScript 2026. For context, here's what developers have been dealing with since 1995: ❌ Months are 0-indexed (January = 0) ❌ No timezone support ❌ Mutability causing subtle bugs ❌ Date arithmetic is a nightmare So what did we do? We wrote `moment.js`. Then `date-fns`. Then `dayjs`. Then `luxon`. Entire ecosystems built to paper over a broken built-in. Temporal fixes all of it — immutable by default, timezone-aware, with a clean and explicit API. But here's what I keep thinking about: 9 years. That's how long it takes to fix something as fundamental as "how do we represent time" in a language used by hundreds of millions of people. The next time your team says "we'll fix that in the next sprint" — maybe set more realistic expectations. Some things just take time. https://lnkd.in/d3e7Qb-C #JavaScript #WebDevelopment #Frontend #TypeScript #TechNews
To view or add a comment, sign in
-
𝗝𝗮𝗵𝗮𝗦𝗰𝗿𝗶𝗽𝘁: 𝗗𝗮𝗮 𝗧𝘆𝗽𝗲𝘀 𝗮𝗻𝗱 𝗩𝗮𝗿𝗶𝗮𝗯𝗹𝗲𝘀 JavaScript is a programming language used for web development. It creates dynamic features for webpages and websites. JavaScript stores information in variables and follows rules to interact with a program. You can hold 8 types of data in a JavaScript variable. These include 7 primitive data types and 1 non-primitive data type. - Number: 12, 3.4 - String: 'text' - Bigint - Boolean: true or false - Undefined - Null - Symbol: unique symbols like percentage, greater than, and less than Non-primitive data types include: - Object: stores multiple values, created with {} or the new keyword - Array: stores multiple elements under a single name, created with [] or the new keyword - Function: can be assigned to a variable, passed as an argument, or returned from a function You can declare JavaScript variables in 4 ways: - Automatically - Var: allows the same variable name, used for function scope - Let: provides block-level scoping, allows reassigning a value but not redeclaring - Const: provides block-level scoping, does not allow reassigning or redeclaring Source: https://lnkd.in/ggEx3tzy
To view or add a comment, sign in
-
✨ 𝗪𝗿𝗶𝘁𝗲 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗦𝘁𝗿𝗶𝗻𝗴𝘀 𝗟𝗶𝗸𝗲 𝗔 𝗛𝘂𝗺𝗮𝗻 ⤵️ Template Literals in JavaScript: Write Strings Like a Human ⚡ 🔗 𝗥𝗲𝗮𝗱 𝗵𝗲𝗿𝗲: https://lnkd.in/d_HhAEsM 𝗧𝗼𝗽𝗶𝗰𝘀 𝗰𝗼𝘃𝗲𝗿𝗲𝗱 ✍🏻: ⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺ ⇢ Why string concatenation becomes messy in real apps ⇢ Template literals — the modern way to write strings ⇢ Embedding variables & expressions using ${} ⇢ Multi-line strings without \n headaches ⇢ Before vs After — readability transformation ⇢ Real-world use cases: HTML, logs, queries, error messages ⇢ Tagged templates (advanced but powerful concept) ⇢ How interpolation works under the hood ⇢ Tradeoffs & common mistakes developers make ⇢ Writing cleaner, more readable JavaScript Thanks Hitesh Choudhary Sir & Piyush Garg Sir, and the amazing Chai Aur Code community 🙌 #ChaiAurCode #JavaScript #WebDevelopment #Frontend #Programming #CleanCode #Hashnode
To view or add a comment, sign in
-
🚀 Just published my latest blog on Template Literals in JavaScript! Tired of messy string concatenation using +? Learn how template literals make your code cleaner, readable, and modern 💡 ✅ Real-world examples ✅ Before vs After comparisons ✅ Practical use cases Perfect for beginners in web development 👨💻 🔗 Read here: https://lnkd.in/gJ6qP-ch #JavaScript #WebDevelopment #Coding #Frontend #100DaysOfCode
To view or add a comment, sign in
-
JavaScript introduced its 𝗯𝗶𝗴𝗴𝗲𝘀𝘁 𝘂𝗽𝗴𝗿𝗮𝗱𝗲 after ECMAScript 2015... The alternative to the broken DATE object. Introducing the 𝗧𝗲𝗺𝗽𝗼𝗿𝗮𝗹 object. According to MDN Docs: "𝘐𝘵 𝘪𝘴 𝘥𝘦𝘴𝘪𝘨𝘯𝘦𝘥 𝘢𝘴 𝘢 𝘧𝘶𝘭𝘭 𝘳𝘦𝘱𝘭𝘢𝘤𝘦𝘮𝘦𝘯𝘵 𝘧𝘰𝘳 𝘵𝘩𝘦 𝘋𝘢𝘵𝘦 𝘰𝘣𝘫𝘦𝘤𝘵." Here is how it is differant than the Date object: - Finally Month will start from 1 in JS. `𝗧𝗲𝗺𝗽𝗼𝗿𝗮𝗹.𝗣𝗹𝗮𝗶𝗻𝗗𝗮𝘁𝗲.𝗳𝗿𝗼𝗺({𝘆𝗲𝗮𝗿: 𝟮𝟬𝟮𝟲, 𝗺𝗼𝗻𝘁𝗵: 𝟰, 𝗱𝗮𝘆: 𝟱}).𝘁𝗼𝗟𝗼𝗰𝗮𝗹𝗲𝗦𝘁𝗿𝗶𝗻𝗴("𝗲𝗻-𝗨𝗦", { 𝗺𝗼𝗻𝘁𝗵: "𝗹𝗼𝗻𝗴" })` The output will be '𝗔𝗽𝗿𝗶𝗹', not May. - Strict Comparisons: To avoid JavaScript's typical "relaxed" type quirks, Temporal includes specific 𝗰𝗼𝗺𝗽𝗮𝗿𝗲 𝗮𝗻𝗱 𝗲𝗾𝘂𝗮𝗹𝘀 𝗔𝗣𝗜𝘀. - 𝗠𝘂𝗹𝘁𝗶𝗽𝗹𝗲 𝗰𝗮𝗹𝗲𝗻𝗱𝗮𝗿 𝘀𝘂𝗽𝗽𝗼𝗿𝘁, beyond the standard Gregorian (ISO 8601) calendar. - `𝗧𝗲𝗺𝗽𝗼𝗿𝗮𝗹.𝗡𝗼𝘄.𝗶𝗻𝘀𝘁𝗮𝗻𝘁()` returns the epoch time with nanosecond precision along with milliseconds, while `𝗗𝗮𝘁𝗲.𝗻𝗼𝘄()` only provides milliseconds. Although Temporal has reached Stage 4 of the TC39 proposal process and is supported in browsers like Google Chrome, Microsoft Edge, and Mozilla Firefox, support in Safari is still pending. Another significant point is that Temporal’s core logic is implemented in a Rust library called 𝘁𝗲𝗺𝗽𝗼𝗿𝗮𝗹_𝗿𝘀. This marks the first time the V8 JavaScript Engine—traditionally written in C++—is incorporating Rust code. Have you tried the Temporal API yet?
To view or add a comment, sign in
More from this author
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