0% found this document useful (0 votes)
126 views

JavaScript Tasks

The document provides 11 coding challenges involving JavaScript functions and programs: 1) validate name and salary fields, 2) check if input is a string, 3) extract characters from a string, 4) find most frequent item in an array, 5) add items to and display contents of an array, 6) find first non-repeated character in a string, 7) find largest number in an array, 8) convert numbers between decimal, binary, hexadecimal and octal, 9) match email addresses with a regular expression, 10) list properties of an object, and 11) display reading status of books in an array.

Uploaded by

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

JavaScript Tasks

The document provides 11 coding challenges involving JavaScript functions and programs: 1) validate name and salary fields, 2) check if input is a string, 3) extract characters from a string, 4) find most frequent item in an array, 5) add items to and display contents of an array, 6) find first non-repeated character in a string, 7) find largest number in an array, 8) convert numbers between decimal, binary, hexadecimal and octal, 9) match email addresses with a regular expression, 10) list properties of an object, and 11) display reading status of books in an array.

Uploaded by

ram babu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

Write a function validating the Name and Salary such that name field
should accpets only alphabets and Salary field should accepts
numerics.
2. Write a JavaScript function to check whether an `input` is a string or
not.
3. Write a JavaScript function to extract a specified number of characters
from a string.
4. Write a JavaScript program to find the most frequent item of an array.
Sample array : var arr1=[3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3];
Sample Output : a ( 5 times )
5. Write a JavaScript program to add items in an blank array and display
the items.
6. Write a JavaScript function to find the first not repeated character.
7. Find the biggest element in the array of numbers by using Math.max
8. Write a JavaScript function to convert a decimal number to binary,
hexadecimal or octal number.
9. Write a pattern that matches e-mail addresses.
10. Write a JavaScript program to list the properties of a JavaScript
object.
Sample object:
var student = {
name : "David Rayy",
sclass : "VI",
rollno : 12 };
Sample Output: name,sclass,rollno
11. Write a JavaScript program to display the reading status (i.e.
display book name, author name and reading status) of the following
books

var library = [
{
author: 'Bill Gates', title: 'The Road Ahead', readingStatus: true
},
{
author: 'Steve Jobs', title: 'Walter Isaacson', readingStatus: true
},
{
author: 'Suzanne Collins', title: 'Mockingjay: The Final Book of The
Hunger Games',
readingStatus: false
}];
O/P: "Already read 'Bill Gates' by The Road Ahead."
"Already read 'Steve Jobs' by Walter Isaacson."
"You still need to read 'Mockingjay: The Final Book of The Hunger
Games' by Suzanne Collins."

You might also like