Mẫu cấu hình JSON và JavaScript thể hiện cấu trúc dữ liệu trò chơi nội bộ của fly68.
{ } example.js{ } example.json
Sao chép mã
JavaScript
// Cấu hình danh mục trò chơi fly68 tham chiếu cục bộ
const fly68GameConfig = {
platform: "fly68" ,
domain: "fly68games.com" ,
supportedPlatform: ["android" ],
featuredGames: [
{ id: "103" , name: "Spirit Wonder" , category: "Trò chơi điện tử" },
{ id: "193" , name: "Reel Royale Sd" , category: "Trò chơi điện tử" },
{ id: "190" , name: "Mayan Destiny" , category: "Trò chơi điện tử" },
{ id: "203" , name: "Princess Frog" , category: "Trò chơi điện tử" },
{ id: "161" , name: "Wings Iguazu" , category: "Trò chơi điện tử" }
]
};
function getGameDetails(gameId) {
return fly68GameConfig.featuredGames.find(item => item.id === gameId) || null ;
}
console.log(getGameDetails("103" )); JSON
{
"platform" : "fly68" ,
"domain" : "fly68games.com" ,
"supportedPlatform" : ["android" ],
"featuredGames" : [
{
"id" : "103" ,
"name" : "Spirit Wonder" ,
"category" : "Trò chơi điện tử"
},
{
"id" : "193" ,
"name" : "Reel Royale Sd" ,
"category" : "Trò chơi điện tử"
},
{
"id" : "190" ,
"name" : "Mayan Destiny" ,
"category" : "Trò chơi điện tử"
},
{
"id" : "203" ,
"name" : "Princess Frog" ,
"category" : "Trò chơi điện tử"
},
{
"id" : "161" ,
"name" : "Wings Iguazu" ,
"category" : "Trò chơi điện tử"
}
]
}