Mẫu khai báo cấu hình đối tượng danh mục trò chơi cục bộ bằng JavaScript và JSON.
JavaScript
// Cấu hình danh mục trò chơi cục bộ cho f8beat
const localGameCatalog = {
platform: "android",
region: "vn",
brand: "f8beat",
featuredGames: [
{ id: "180", name: "Majestic Emp", category: "Slot" },
{ id: "071", name: "Circus Delight", category: "Slot" },
{ id: "021", name: "Mr Hallow Jp", category: "Slot" },
{ id: "176", name: "Diner Frenzy", category: "Slot" },
{ id: "188", name: "Fortune Horse", category: "Slot" }
],
filterByCategory: function(categoryName) {
return this.featuredGames.filter(game => game.category === categoryName);
}
};
console.log("Số trò chơi Slot khả dụng:", localGameCatalog.filterByCategory("Slot").length);
JSON
{
"platform": "android",
"region": "vn",
"brand": "f8beat",
"featuredGames": [
{
"id": "180",
"name": "Majestic Emp",
"category": "Slot"
},
{
"id": "071",
"name": "Circus Delight",
"category": "Slot"
},
{
"id": "021",
"name": "Mr Hallow Jp",
"category": "Slot"
},
{
"id": "176",
"name": "Diner Frenzy",
"category": "Slot"
},
{
"id": "188",
"name": "Fortune Horse",
"category": "Slot"
}
]
}