[go: up one dir, main page]

0% found this document useful (0 votes)
11 views4 pages

Js Exam 1

The document contains JavaScript programming tasks including listing object properties, creating objects with methods for summation, generating unique values from an array, converting strings to abbreviated forms, hiding email addresses, and checking student course subscriptions. Sample code snippets and test data are provided for each task. The tasks aim to enhance JavaScript skills through practical coding exercises.

Uploaded by

lathiyayug13
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)
11 views4 pages

Js Exam 1

The document contains JavaScript programming tasks including listing object properties, creating objects with methods for summation, generating unique values from an array, converting strings to abbreviated forms, hiding email addresses, and checking student course subscriptions. Sample code snippets and test data are provided for each task. The tasks aim to enhance JavaScript skills through practical coding exercises.

Uploaded by

lathiyayug13
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/ 4

File Topic – 6

1. 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

2. Create 3rd object and write a sum method in object and do 2 object’s sum
of calc1 and calc 2
const calc1 = {
a: 33,
b: 8
}
const calc2 = {
a: 54,
b: 22
}
hint:- use js function call / apply / bind.
result:
calc1 sum = 41
calc2 sum = 76

3. create a unique values array of


let Ary = [‘shoue’, ‘top’ , ‘shoue’ , ‘shoue’ , ‘t-shirt’ , ‘pent’ , ‘t-shirt’ , ‘shirt’ ,
‘shirt‘, ’tie’ , ‘tie’] ;
Note: Don’t use array.filter method
File Topic – 8

1. Write a JavaScript function to convert a string in abbreviated form.

Test Data :
console.log(abbrev_name("Robin Singh"));
"Robin S."

2. Write a JavaScript function to hide email addresses to protect from


unauthorized user.

Test Data :
console.log(protect_phone(6453964782);
"645******2"

3. find if all the students have subscribed to at least two courses and create a
new array.
let students = [
{
'id': 001,
'f_name': 'Alex',
'l_name': 'B',
'gender': 'M',
'married': false,
'age': 22,
'paid': 250,
'courses': ['JavaScript', 'React']
},
{
'id': 002,
'f_name': 'Ibrahim',
'l_name': 'M',
'gender': 'M',
'married': true,
'age': 32,
'paid': 150,
'courses': ['JavaScript', 'PWA']
},
{
'id': 003,
'f_name': 'Rubi',
'l_name': 'S',
'gender': 'F',
'married': false,
'age': 27,
'paid': 350,
'courses': ['Blogging', 'React', 'UX']
},
{
'id': 004,
'f_name': 'Zack',
'l_name': 'F',
'gender': 'M',
'married': true,
'age': 36,
'paid': 250,
'courses': ['Git', 'React', 'Branding']
}
];

You might also like