Posts

practice test of Arithmetic Operations:

 Creating 200 practice questions for arithmetic operations might be excessive, but I can provide you with a set of varied questions to practice arithmetic operations in JavaScript. Here's a collection of 20 practice questions: 1. **Question**: Perform addition: 5 + 3    **Answer**:     ```javascript    let sum1 = 5 + 3; // Answer: 8    ``` 2. **Question**: Perform subtraction: 10 - 4    **Answer**:     ```javascript    let difference1 = 10 - 4; // Answer: 6    ``` 3. **Question**: Perform multiplication: 7 * 6    **Answer**:     ```javascript    let product1 = 7 * 6; // Answer: 42    ``` 4. **Question**: Perform division: 20 / 4    **Answer**:     ```javascript    let quotient1 = 20 / 4; // Answer: 5    ``` 5. **Question**: Perform addition: -8 + 5    **Answer**:     ```javascript    let sum2 = -8 + 5; // Answer: -3    ``` 6. **Question**: Perform subtraction: 15 - (-3)    **Answer**:     ```javascript    let difference2 = 15 - (-3); // Answer: 18    ``` 7. **Question**: Perform mu

Switch case make weekly to do list

var day = "abc" switch (day) {   case "Monday":     console.log("today is monday and go to office" );     break;   case "Tuesday":      console.log("today is Tuesday and go to mandir" );     break;   case "wednesday":      console.log("today is Wednesday and go to meeting");     break;   case "Thursday":      console.log("today is Thursday and go to sai baba mandir");     break;   case "friday":      console.log("today is Friday and last day of office" );     break;   case "saturday":      console.log("today is Saturday and go rest" );     break;   case "sunday":      console.log("today is sunday and go to movie" );     break;     default:console.log("no cond match") }

string practice test

 how to find the length of string let a = "navjotsingh" let b = a.length console.log(`the length of ${a} is ${b}`) =========================================================================== let a = "navjotsingh" let b = a.length console.log(a[2]) ========================================================================= string method

how to find the number is positive, negative and zero with if else statment

 var numb = -1; if (numb ===0){   console.log("zero") } else if(numb > 0){   console.log("positive") } else{   console.log("negative") }

for loop basic practice test for beeginer

1. Print numbers from 1 to 10: for (let i = 1; i <= 10; i++) {   console.log(i); }   2. Print even numbers from 2 to 20: for (let i = 2; i <= 20; i += 2) { console.log(i); } 3. Calculate the sum of numbers from 1 to 100: let sum = 0; for (let i = 1; i <= 100; i++) { sum += i; } console.log("The sum is:", sum); ------------------ 4. Print the multiplication table of 7: for (let i = 1; i <= 12; i++) { console.log(7 * i); } 5. Check if a number is even or odd: let number = 15; if (number % 2 === 0) { console.log(number + " is even."); } else { console.log(number + " is odd."); } 6. Print a pattern of stars: for (let i = 1; i <= 5; i++) { let stars = ""; for (let j = 1; j <= i; j++) { stars += "*"; } console.log(stars); } 7. Find the factorial of a number: function factorial(number) { let result = 1; for (let i = 1; i <= number; i++) { result *= i; } return result; } console.log(&quo

for loops js practice sum , factorial

Sum of all number  let sum = 0; let n = 3; for(let i = 0; i < n; i++){   sum += (i+1) } console.log(`the sum of first ${n} natural number is ${sum}`) ----------------------------------------------------------------------------------------------------------------- let num = 5; let factorial = 1; for(let i = 1; i <= num; i++){   factorial *=i; } console.log(`the factorial of {num} is : ${factorial}`) ---------------------------------------------------------------------------------------------------------------------

JavaScript: Check whether a given positive number is a multiple of 3 or a multiple of 7

  // JavaScript: Check whether a given positive number is a multiple of 3 or a multiple of 7 let a = Number ( prompt ( "enter the value" )) // let b = Number(prompt("enter the value")) if ( a % 3 == 0 || a % 7 == 0 ){     console . log ( `yes ${ a } is dividible ` ) } else {     console . log ( `no ${ a } is not devided ` ) }