5 JavaScript coding Exercises 2

5 JavaScript coding Exercises 2 FizzBuzzPalindrome checkerHangman gameShopping cartTyping speed test FizzBuzz Source code: for (let i = 1; i <= 100; i++) {   if (i % 3 === 0 && i % 5 === 0) {     console.log(‘FizzBuzz’);   } else if (i % 3 === 0) {     console.log(‘Fizz’);   } else if (i % 5 === … Read more

5 fun JavaScript coding exercises

5 JavaScript coding Exercises 1 Reverse a String:FizzBuzz:Palindrome Checker:Random Number Generator:Capitalize the First Letter of Each Word: Reverse a String: Write a function that takes a string as an argument and returns the string in reverse order. For example, if the input string is “hello”, the output should be “olleh”. function reverseString(str) {   return str.split(“”).reverse().join(“”); … Read more

10 JavaScript Coding Mistakes with solutions

10 JavaScript Coding Mistakes with solutions Not declaring variables properly:Using the wrong comparison operator:Not using semicolons:Not understanding scoping:Using “var” instead of “let” or “const”:Instead, use “let” or “const”:Using “==” instead of “===”:Not using curly braces in if statements:Using “parseFloat” instead of “parseInt”:Not handling asynchronous code properly:Example using a promise:Example using async/await:Not properly scoping variables:Example using … Read more

JavaScript Code Exercises 4

JavaScript Code Exercises 4 Exercise 1: Sum All Numbers in a RangeExercise 2: Diff Two ArraysExercise 3: Seek and DestroyExercise 4: Wherefore art thou Exercise 1: Sum All Numbers in a Range Write a function that takes an array of two numbers as input and returns the sum of all the numbers between them, inclusive. … Read more

JavaScript Code Exercises 2

JavaScript Code Exercises 2 Exercise 1: Reverse a stringExercise 2: Factorialize a numberExercise 3: Check for palindromeExercise 4: Find the longest wordExercise 5: Title case a sentenceExercise 6: Return largest numbers in arraysExercise 7: Confirm the endingExercise 8: Repeat a stringExercise 9: Truncate a stringExercise 10: Chunky monkey Exercise 1: Reverse a string Write a … Read more

JavaScript Code Mistakes and Solutions 4

JavaScript Code Mistakes and Solutions 4 Not using ‘try-catch-finally’ for resource management:Not using ‘const’ for values that won’t change:Not checking for null or undefined:Not using ‘Array.prototype.filter()’:Not using ‘Array.prototype.forEach()’:Not using ‘Object.assign()’ for object cloning:Not using ‘Array.prototype.some()’ or ‘Array.prototype.every()’:Not using ‘Array.prototype.find()’ or ‘Array.prototype.findIndex()’:Not using ‘Array.prototype.sort()’:Not handling asynchronous code properly: Not using ‘try-catch-finally’ for resource management: Not using … Read more

JavaScript Code Mistakes and Solutions 3

JavaScript Code Mistakes and Solutions 3 Not using ‘async/await’ with promises:Not using the ‘this’ keyword correctly:Not understanding the difference between ‘== and ‘===’:Using ‘var’ instead of ‘let’ or ‘const’:Not handling errors correctly:Not using ‘Array.prototype.map()’ correctly:Not understanding the event loop:Not using ‘template literals’ for string interpolation:Not using ‘Object destructuring’:Not using ‘Array.prototype.reduce()’: Not using ‘async/await’ with promises: … Read more