Minh họa cấu hình danh mục trò chơi khởi đầu bằng JavaScript và JSON.
{ } guideConfig.js{ } guideConfig.json
Sao chép mã
JavaScript
// Cấu hình danh mục trò chơi khởi đầu trên giao diện cục bộ
const guideConfig = {
platform: 'CF68' ,
locale: 'vi-VN' ,
featuredCategory: 'Nổ hũ' ,
initialGames: [
{ id: '083' , name: 'Fortune Ox' , highlight: 'Vòng quay chú trâu' },
{ id: '177' , name: 'Dragons Treas' , highlight: 'Kho báu rồng' },
{ id: '111' , name: 'Garuda Gems' , highlight: 'Hệ số ngọc quý' }
],
defaultSettings: {
soundEnabled: true ,
quickSpin: false
}
};
function getFeaturedGameNames(config) {
return config.initialGames.map(game => game.name);
}
// Xuất danh sách tên trò chơi khởi đầu
console.log('Trò chơi đề xuất:' , getFeaturedGameNames(guideConfig)); JSON
{
"platform" : "CF68" ,
"locale" : "vi-VN" ,
"featuredCategory" : "Nổ hũ" ,
"initialGames" : [
{
"id" : "083" ,
"name" : "Fortune Ox" ,
"highlight" : "Vòng quay chú trâu"
},
{
"id" : "177" ,
"name" : "Dragons Treas" ,
"highlight" : "Kho báu rồng"
},
{
"id" : "111" ,
"name" : "Garuda Gems" ,
"highlight" : "Hệ số ngọc quý"
}
],
"defaultSettings" : {
"soundEnabled" : true ,
"quickSpin" : false
}
}