0% found this document useful (0 votes)
3 views3 pages

Js Problems

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Js Problems

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

write a JavaScript program to print difference between biggest and smallest number of an
array

2. Write a JavaScript program to find the average of elements in an array of numbers.

3. Write a JavaScript program to print sum of even numbers from given array

4. Write a JavaScript program to count number of duplicates elements of an array

5. Write a JavaScript program to create array of even numbers from give array

6. Write a JavaScript program to print running time

7. Write a JavaScript program to print student details who got highest marks, create objects
using class

8. Write a JavaScript program to add colors to all h1 tags when the button is clicked

9. write a JavaScript program to check given number is palindrome number or not

10. write a JavaScript program to check given string is palindrome or not

11. Write a JavaScript program to remove duplicate elements from an array.

12. Write a JavaScript program to print incremental value every time when button is clicked

13. write a JavaScript program to print prime numbers between 1 to 100

14. Write a JavaScript program to find the second largest element in an array.

15. write a JavaScript program to check given number is strong number or not

16. write a JavaScript program to remove odd numbers from given array

17. write a JavaScript program to count number of vowels in a string

18. Write a JavaScript program to print GCD of given two numbers

19. write a JavaScript program to check given number is armstrong number or not

20. write a JavaScript program to second smallest number from given array

21. Write a JavaScript program to print N digits in fibonacci series

22. Write a JavaScript program to create subclasses for different types of people (e.g., Student,
Teacher) inheriting from the Person class and adding additional properties and methods.

23. Write a JavaScript program to apply text color for h1 which user entered in input tag and
submit

24. write a JavaScript program to print following pattern

20 18 16 14

12 10 8

64

2
25. write a javascript program to print following pattern

1234

5678

9 10 11 12

13 14 15 16

26. Write JavaScript program to create new array of leap years from given array

[Link] a javascript program to print follwoing pattern

54321

4321

321

21

28. write a JavaScript program to store factorials of each number into new array from given array

29. write a JavaScript program to implement promises for even numbers, if number is even fulfil
the promise and it is odd reject the promise

30. write a JavaScript program to perform addition of n numbers using single function in js

31. Given an array of objects representing students, use the map method to create a new array
of objects where each object has an additional property isAdult that is true if the student's age
is 18 or above, and false otherwise.

students = [

{ name: 'John', age: 17 },

{ name: 'Jane', age: 19 },

{ name: 'Jack', age: 18 },

];

output :

{ name: 'John', age: 17, isAdult: false },

{ name: 'Jane', age: 18, isAdult: true },

{ name: 'Jack', age: 19, isAdult: true }

]
32. Given an array of objects representing books, use the findIndex method to find the index of
the book with a specific title given by the user.

const books = [

{ title: 'Book A', author: 'Author 1' },

{ title: 'Book B', author: 'Author 2' },

{ title: 'Book C', author: 'Author 3' },

];

33. Given an array of employee objects, each with name and salary properties, print the names
of employees in ascending order who earn more than a specified amount given by the user.

const employees = [

{ name: 'Alice', salary: 50000 },

{ name: 'Bob', salary: 60000 },

{ name: 'Charlie', salary: 40000 },

];

34. Given an array of movie objects, each with properties movieName, movieHero, movieGenre,
and releaseDate, write a function to sort the array in ascending order of the releaseDate

movies = [

{ movieName: 'Movie A', movieHero: 'Hero A', movieGenre: 'Action', releaseDate: '2020-01-15' },

{ movieName: 'Movie B', movieHero: 'Hero B', movieGenre: 'Drama', releaseDate: '2019-06-10' },

{ movieName: 'Movie C', movieHero: 'Hero C', movieGenre: 'Comedy', releaseDate: '2021-12-25'
},

{ movieName: 'Movie D', movieHero: 'Hero D', movieGenre: 'Horror', releaseDate: '2018-04-
05'},];

35. Write a function that takes an object and a list of keys, and returns a new object that only
contains the properties from the list of keys.

const obj = { a: 1, b: 2, c: 3, d: 4 };

const keys = ['b', 'c'];

output : { b: 2, c: 3 }

You might also like