0% found this document useful (0 votes)
22 views2 pages

Practice Set Advjs

The document provides examples of JavaScript practices including creating classes, overriding methods, stringifying variables and objects, parsing JSON, working with APIs, closures, and manipulating the DOM. It contains over 20 code snippets across various JavaScript concepts.

Uploaded by

kabirt636
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)
22 views2 pages

Practice Set Advjs

The document provides examples of JavaScript practices including creating classes, overriding methods, stringifying variables and objects, parsing JSON, working with APIs, closures, and manipulating the DOM. It contains over 20 code snippets across various JavaScript concepts.

Uploaded by

kabirt636
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
You are on page 1/ 2

Practice set advanced Javascript

1. Create an Animal class. The class will have name, age, color, legs properties and create different
methods

2. Create a Dog and Cat child class from the Animal Class.

3. Override the method you create in Animal class

-------------------------------------------------------------------------

4. const skills = ['HTML', 'CSS', 'JS', 'React','Node', 'Python'] Change skills array to JSON.

5. let age = 25; Stringify the age variable

6. let isMarried = true Stringify the isMarried variable.

7. const student = { firstName:'Talib', lastName:'Khan', age:25, isMarried:true, skills:['HTML', 'CSS',


'JS', 'React','Node', 'Python', ] } Stringify the student object

8. Stringify the students object with only firstName, lastName and skills properties

9. const txt = `{ "Alex": { "email": "[email protected]", "skills": [ "HTML", "CSS", "JavaScript" ], "age": 20,
"isLoggedIn": false, "points": 30 }, "Asab": { "email": "[email protected]", "skills": [ "HTML", "CSS",
"JavaScript", "Redux", "MongoDB", "Express", "React", "Node" ], "age": 25, "isLoggedIn": false,
"points": 50 }, "Brook": { "email": "[email protected]", "skills": [ "HTML", "CSS", "JavaScript",
"React", "Redux" ], "age": 30, "isLoggedIn": true, "points": 50 }, "Daniel": { "email":
"[email protected]", "skills": [ "HTML", "CSS", "JavaScript", "Python" ], "age": 20, "isLoggedIn": false,
"points": 40 }, "John": { "email": "[email protected]", "skills": [ "HTML", "CSS", "JavaScript", "React",
"Redux", "Node.js" ], "age": 20, "isLoggedIn": true, "points": 50 }, "Thomas": { "email":
"[email protected]", "skills": [ "HTML", "CSS", "JavaScript", "React" ], "age": 20, "isLoggedIn":
false, "points": 40 }, "Paul": { "email": "[email protected]", "skills": [ "HTML", "CSS", "JavaScript",
"MongoDB", "Express", "React", "Node" ], "age": 20, "isLoggedIn": false, "points": 40 } } `

Parse the txt JSON to object.

10. Find the user who has many skills from the variable stored in txt.

------------------------------------------------------------------------------------

11. Read the countries API using fetch and print the name of country, capital, languages, population
and area. https://restcountries.com/v2/all

12. Print out all the cat names in to catNames variable. https://api.thecatapi.com/v1/breeds

13. Create a closure which has one inner function

14. Create a closure which has three inner functions

---------------------------------------------------------------------------------

15. Create an index.html file and put four p elements as above: Get the first paragraph by using
document.querySelector(tagname) and tag name.

16. Get each of the the paragraph using document.querySelector('#id') and by their id

17. Get all the p as nodeList using document.querySelectorAll(tagname) and by their tag name
18. Loop through the nodeList and get the text content of each paragraph

19. Set a text content to paragraph the fourth paragraph,Fourth Paragraph

20. Set id and class attribute for all the paragraphs using different attribute setting methods

21. Change stye of each paragraph using JavaScript(eg. color, background, border, font-size, font-
family)

22. Select all paragraphs and loop through each elements and give the first and third paragraph a
color of green, and the second and the fourth paragraph a red color

23. Set text content, id and class to each paragraph

24. Do coding for the desired output as given

You might also like