<!DOCTYPE html>
<
html
>
<
head
>
<
title
>BackboneJS pluck collection</
title
>
type
=
"text/javascript"
></
script
>
<
script
src
=
type
=
"text/javascript"
></
script
>
<
script
src
=
type
=
"text/javascript"
></
script
>
</
head
>
<
body
>
<
h1
style
=
"color: green;"
>
GeeksforGeeks
</
h1
>
<
h3
>BackboneJS pluck collection</
h3
>
<
script
type
=
"text/javascript"
>
var Book = Backbone.Model.extend();
var books = Backbone.Collection.extend({
model: Book,
});
var Library = new books();
var b1 = new Book({
title: "Ram",
Author: "Amish Tripathi",
vol: 1
});
var b2 = new Book({
title: "Lolita",
Author: "Vladimir Nabokov",
vol: 2
});
var b3 = new Book({
title: "The Palace of Illusion",
Author: "Chitra Banerjee",
vol: 1
});
var b4 = new Book({
title: "Wings of Fire",
Author: "A. P. J. Abdul kalam",
vol: 1
});
Library.add(b1);
Library.add(b2);
Library.add(b3);
Library.add(b4);
var temp = Library.pluck("title");
var temp1 = Library.pluck("Author");
var temp2 = Library.pluck("vol");
document.write("Details of Books are : <
br
> ");
for (let x = 0; x <
temp.length
; x++)
document.write(`${temp[x]} volume ${temp2[x]}
is write by ${temp1[x]},<br>`);
</
script
>
</
body
>
</
html
>