-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestions.yaml
More file actions
65 lines (56 loc) · 3.55 KB
/
Questions.yaml
File metadata and controls
65 lines (56 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Here is a collection of 50 JavaScript Questions, divided into groups of 10, based on topics 1-8, with increasing complexity.
1. Basic Console Usage (10 Questions)
1. Log your name and and favorite hobby to the console.
2. Perform and log the result of 45 * 2 - 10.
3. Use console.log() to display the current year.
4. Create two variables for first and last name. Concatenate and log them.
5. Track the value of a variable by logging it before and after updating.
6. Use console.error() to simulate and error message.
7. Log the square of the number 12 to the console.log.
8. Print the type of a variable holding the value true.
9. Create a variable holding your age and log whether it's greater than 10.
10. Log the result of 100 / 0 and observe the output.
2. Variables and Data Types (10 Questoins)
11. Declare a variable using let and log its value.
12. create a constant to store the value of PI and log it.
13. Reassign a value to a variable declared with let and log the result.
14. check the type of null and log it.
15. Create a variable with a number as a string (e.g., "25") and log its type.
16. Use typeof to check the type of a boolean variable.
17. Create three variables of types string, number and boolean and log their values.
18. Declare a variable without assigning a value. Log its type.
19. Create a variable with undefined and log its type.
20. Use const to create an array. Try reassigning the array and observe the error.
3. Loops (10 Questions)
21. Write a for loop to print numbers from 1 to 50.
22. Use a while loop to sum the numbers from 1 to 10.
23. Create a for..of loop to log each character of the string "JavaScript";
24. Write a for loop that skips even numbers between 1 and 20;
25. Use a do...while loop to print numbers from 5 to 1.
26. Create a for loop that calculates the factorial of 5.
27. Write a nested loop to print a 3x3 grid of numbers.
28. Use a for loop to reverse an array [1, 2, 3, 4, 5];
29. Write a while loop that logs numbers from 1 to 100 divisible by 5.
30. Use a for...in loop to iterate over an object and log its keys;
4. Arrays (10 Questions)
31. Create any array of your top 5 favorite movies and log it.
32. Find and log the second element of an array.
33. Add two new elements to the start of an array using .unshift().
34. Remove the last element of an array and log the updated array.
35. Use .slice() to extract the first three elements of an array.
36. Find the index of a specific element in an array using .indexOf().
37. Check if the value exists in an array using .includes().
38. Combine two arrays using .concat().
39. Sort an array of number in ascending order.
40. Write a program that creates a copy of array without mutating the original.
5. Functions (10 Questions)
1. Write a function to check that if the number is even or odd.
2. Create a function to calculate the area of the circle with a given radius.
3. Write a function that accepts an array and return the sum of its elements.
4. Create a function that checks that if a string starts with a specific character.
5. Write a function to find the maximum of two numbers.
6. Write a function that takes a number and return its factorial.
7. Write a function that accepts a string and return it reverse.
8. Create a function to find the largest number in an array.
9. Write a function that converts the string into kabab case.
10. Create a function that logs hello world every time it is called.