Struktur konfigurasi objek lokal katalog game rk888.
{ } example.js{ } example.json
Salin kode
JavaScript
// Konfigurasi lokal katalog permainan rk888
const rk888CatalogConfig = {
brand: "rk888" ,
country: "id" ,
language: "Bahasa Indonesia" ,
initialCategories: ["Slot" , "Arcade" ],
featuredGames: [
{ id: "188" , name: "Fortune Horse" , category: "Slot" },
{ id: "141" , name: "Ninja Raccoon" , category: "Slot" },
{ id: "101" , name: "Crypt Fortune" , category: "Slot" },
{ id: "014" , name: "Plushie Frenzy" , category: "Arcade" },
{ id: "158" , name: "Futebol Fever" , category: "Slot" }
],
defaultFilter: "all"
};
function getGamesByCategory(catalog, categoryName) {
if (categoryName === "all" ) return catalog.featuredGames;
return catalog.featuredGames.filter(game => game.category === categoryName);
}
// Contoh pengujian filter lokal
const slotGames = getGamesByCategory(rk888CatalogConfig, "Slot" );JSON
{
"brand" : "rk888" ,
"country" : "id" ,
"language" : "Bahasa Indonesia" ,
"initialCategories" : ["Slot" , "Arcade" ],
"featuredGames" : [
{ "id" : "188" , "name" : "Fortune Horse" , "category" : "Slot" },
{ "id" : "141" , "name" : "Ninja Raccoon" , "category" : "Slot" },
{ "id" : "101" , "name" : "Crypt Fortune" , "category" : "Slot" },
{ "id" : "014" , "name" : "Plushie Frenzy" , "category" : "Arcade" },
{ "id" : "158" , "name" : "Futebol Fever" , "category" : "Slot" }
],
"defaultFilter" : "all"
}