Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function isObject(value) {
- return typeof value === "object" && value.constructor === Object;
- }
- function displayData(obj) {
- for(var key in obj) {
- if( isObject(obj[key]) ) {
- console.log(key + ":");
- displayData(obj[key]);
- continue;
- }
- console.log(key + ": " + obj[key]);
- }
- }
- var person = {
- "imię": "Grzegorz",
- "nazwisko": "Sumara",
- "wiek": 30,
- "język programowania": {
- "html": "HTML",
- "css": "CSS",
- "JavaScript": "JavaScript",
- "jQuery": "jQuery",
- "Angular": {
- "Old Version": 1,
- "New Version": 2
- }
- }
- };
- displayData(person);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement