JavaScript Practice – Day by Day Improvement Today I practiced a JavaScript logic problem “Array Chunking.” The goal was to split an array into smaller subarrays (chunks) of a given size. Concepts & Methods Used: • for loop for iteration • Array.slice() method to extract subarrays • Incrementing index by chunk size (i += n) for efficient traversal This approach helps break a large array into manageable chunks and improves understanding of array manipulation and problem-solving in JavaScript. I’m focusing on improving my JavaScript logic day by day through consistent practice. 💻 #JavaScript #ProblemSolving #CodingPractice #WebDevelopment #FrontendDevelopment
Improving JavaScript Logic with Array Chunking Practice
More Relevant Posts
-
🚀 Today’s JavaScript Practice: Merging Two Arrays Using a For Loop Today I practiced how to merge two arrays in JavaScript using a for loop instead of built-in methods. This helped me better understand how array indexing and loops work internally. 🔹 First, I created two arrays with some numbers. 🔹 Then I used a for loop to copy elements from the first array into a new array. 🔹 After that, I used another for loop to add elements of the second array after the first array’s elements. 💻 Example idea: data1 = [10,20,30,40,50] data2 = [60,70,80,90,100] ✅ Result → [10,20,30,40,50,60,70,80,90,100] You can also check my GitHub profile for more practice projects and code. #DSA #JavaScript #WebDevelopment #CodingPractice 😊
To view or add a comment, sign in
-
I ran a small JavaScript experiment today, and it was a good reminder that performance often hides inside simple concepts. I used the same function twice with the same inputs. The first call took noticeable time. The second call returned almost instantly. Nothing changed in the inputs. Nothing changed in the output. The only difference was that the second time, JavaScript didn’t need to do the work again. That’s the beauty of memoization. Instead of recalculating, it remembers the previous result and returns it from cache. What looks like a small optimization in code can make a big difference in how efficiently an application behaves. The deeper I go into JavaScript, the more I realize: the real power is not just in writing code — it’s in understanding how to make code smarter. #JavaScript #WebDevelopment #FrontendDevelopment #Memoization #Closures
To view or add a comment, sign in
-
-
✨ Object Methods in JavaScript Objects are one of the most fundamental parts of JavaScript, and knowing how to work with them efficiently can make your code much more powerful and readable. In today’s post, I’ve covered important object methods in JavaScript that every developer should know. Understanding these methods helps you manipulate data structures more effectively and write cleaner, more efficient code. If you work with JavaScript regularly, mastering object methods is definitely a must. 👇 Which JavaScript object method do you use the most in your projects? Follow Muhammad Nouman for more useful content #learningoftheday #1000daysofcodingchallenge #FrontendDevelopment #WebDevelopment #JavaScript #React #Next #CodingCommunity
To view or add a comment, sign in
-
Variables in JavaScript Most beginners learn variables in JavaScript… But very few understand values first. And without understanding values, JavaScript can feel confusing. Let’s make it simple. 👇 In JavaScript, a value is simply data stored in memory. When you write code like: let age = 25; 👉 age = variable 👉 25 = value Here are some common JavaScript values: • Number → 10, 3.14, 100 • String → "Hello", "JavaScript" • Boolean → true or false • Null / Undefined → empty or missing values • Objects & Arrays → complex values like {} and [] Think of it like this: 📦 Variable = Box 🎁 Value = What’s inside the box JavaScript programs run by creating, storing, and using values all the time. If you understand values well, the rest of JavaScript becomes much easier. #JavaScript #WebDevelopment #FrontendDevelopment #ProgrammingBasics #JavaScriptTips #LearnToCode #CodingForBeginners #SoftwareDevelopment #JSDeveloper #TechEducation
To view or add a comment, sign in
-
-
💻 JavaScript Practice: Merging Two Arrays Using a While Loop Today I practiced an important JavaScript concept — merging two arrays using a while loop. It’s a great exercise to improve logical thinking and understand how loops and indexes work together. Instead of using built-in methods like concat() or the spread operator, I tried doing it manually with a while loop. This helps in understanding how data moves step by step inside arrays. Key Idea: Start with two arrays. Use a while loop to iterate through them. Push elements into a new array until all elements are merged. Example: let arr1 = [1, 2, 3]; let arr2 = [4, 5, 6];then let result = [1,2,3,4,5,6] Practicing these small problems helps build a stronger foundation in JavaScript logic and problem-solving. 🚀 #JavaScript #DSA #WebDevelopment #CodingPractice #FrontendDevelopment 😊
To view or add a comment, sign in
-
Day 1 of 30 days of javascript challenge. problem-2667 Problem - Write a function createHelloWorld that returns another function, that returns "Hello World" As this is my first code, I revised my notes on javascript scope. ☑️ Function scope - Any variables declared inside a function body cannot be accessed outside the function body, but global variables can be used inside function body ☑️ Block scope - Any variable declared inside { } cannot be used outside the { } block, although it supports only let and const keyword, var can be used ☑️ Lexical scope - A variable declared outside a function can be accessed inside another function defined after the variable declaration. (The opposite is not true ) This problem uses the concept of closures and higher order functions. Please feel free to discuss where can I improve the code or if you have a different perspective, comment below your views. #javascript #coding #development #motivation #goals #leetcode #webdevelopment
To view or add a comment, sign in
-
-
🚨 Confused about Hoisting in JavaScript? You’re not alone. 💡 It’s one of those concepts that feels strange at first — but once you get it, your understanding of JavaScript becomes much stronger. 🔹 Hoisting • JavaScript moves declarations to the top of their scope • Happens during the compilation phase • Allows variables and functions to be used before declaration 🔹 var vs let vs const • var → hoisted and initialized with undefined • let & const → hoisted but NOT initialized (Temporal Dead Zone) • Accessing them before declaration throws an error 🔹 Functions • Function declarations → fully hoisted • Function expressions → behave like variables (not fully hoisted) ⚡ Quick rule many developers follow: • var → hoisted safely (but can cause bugs) • let/const → safer, but respect TDZ • Functions → declarations hoisted, expressions not 📌 Hoisting doesn’t move your code — JavaScript just changes how it reads it internally. #JavaScript #WebDevelopment #FrontendDevelopment #Coding #LearnToCode #100DaysOfCode
To view or add a comment, sign in
-
-
🚨 Many beginners get confused between var, let, and const in JavaScript. They all create variables… but they behave very differently. If you understand this early, your JavaScript code will be cleaner and safer. Here is the simple difference 👇 • var Old way to create variables. It is function scoped and can be re-declared and updated. • let Modern JavaScript variable. It is block scoped and can be updated but not re-declared in the same scope. • const Used for values that should not change. It is block scoped and cannot be re-assigned. Quick tip 💡 Use const by default, let when value changes, and avoid var in modern JavaScript. Small concepts like this make a big difference in writing better code. #javascript #webdevelopment #frontenddevelopment #codingtips #learnjavascript #programmingbasics #softwaredevelopment #devcommunity #100daysofcode #javascriptdeveloper
To view or add a comment, sign in
-
-
🧠 JavaScript Concept: Hoisting Explained Hoisting is JavaScript's behavior of moving variable and function declarations to the top of their scope before execution. This is why we can sometimes use variables or functions before they are declared. Example: console.log(name); // undefined var name = "Arun"; Why undefined? Because JavaScript internally treats it like this: var name; console.log(name); name = "Arun"; 🔹 Important Points: • "var" is hoisted and initialized with "undefined" • Function declarations are fully hoisted • "let" and "const" are hoisted but stay in the Temporal Dead Zone (TDZ) ⚠️ Accessing "let" or "const" before declaration will throw an error. 📌 Best Practice: Avoid relying on hoisting — always declare variables at the top for better readability. #javascript #frontenddevelopment #reactjs #webdevelopment #coding
To view or add a comment, sign in
-
-
✨ 𝗗𝗮𝘆 𝟮𝟮 𝗼𝗳 𝗠𝘆 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗝𝗼𝘂𝗿𝗻𝗲𝘆 🚀 (𝗙𝗶𝗻𝗮𝗹 𝗗𝗮𝘆 𝗼𝗳 𝗝𝗦 𝗙𝘂𝗻𝗱𝗮𝗺𝗲𝗻𝘁𝗮𝗹𝘀) Today I learned about the 𝘁𝗵𝗶𝘀 𝗸𝗲𝘆𝘄𝗼𝗿𝗱 and how its value changes in different scenarios in JavaScript. I explored how 𝘁𝗵𝗶𝘀 behaves in: 🔹 Global context 🔹 Regular functions 🔹 Object methods 🔹 Arrow functions 🔹 Constructor functions / classes I also learned how to control 𝘁𝗵𝗶𝘀 using 𝗰𝗮𝗹𝗹(), 𝗮𝗽𝗽𝗹𝘆(), 𝗮𝗻𝗱 𝗯𝗶𝗻𝗱(). Another important concept was understanding 𝗦𝘁𝗿𝗶𝗰𝘁 𝗠𝗼𝗱𝗲 𝘃𝘀 𝗡𝗼𝗻-𝗦𝘁𝗿𝗶𝗰𝘁 𝗠𝗼𝗱𝗲. In strict mode ("𝘂𝘀𝗲 𝘀𝘁𝗿𝗶𝗰𝘁"), JavaScript enforces stricter rules and prevents some common mistakes. For example, inside a regular function this becomes undefined instead of the global object, making behavior more predictable. Finishing these JavaScript fundamentals feels great. Now it’s time to move forward and build more complex projects! 💪 #JavaScript #100DaysOfCode #WebDevelopment #LearningJourney #FrontendDevelopment
To view or add a comment, sign in
-
Explore related topics
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