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']
}
];