Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e87036e

Browse files
fetching data from object
1 parent 1397370 commit e87036e

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

‎practise.js

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11

2-
// object constructor
3-
4-
function Student (first , last , ag , cla){
5-
this.firstName = first,
6-
this.lastName = last,
7-
this.age = ag,
8-
this.class = cla
9-
}
10-
11-
let student1 = new Student("Rohit" , "Bhadane" , 23 , 5);
12-
13-
console.log(student1);
2+
const datas = [
3+
{
4+
name: 'rohit',
5+
age: 19,
6+
profession: 'software engineer'
7+
},
8+
{
9+
name: 'sumit',
10+
age: 20,
11+
profession: 'web designer'
12+
}
13+
];
14+
15+
function getData(){
16+
setTimeout(()=>{
17+
let output = "";
18+
19+
datas.forEach((data , index)=>{
20+
output += `<li>${data.name}: ${data.age}</li>`
21+
})
22+
23+
document.body.innerHTML = output;
24+
} , 1000)
25+
}
26+
27+
getData();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /