Created
          August 25, 2023 08:20 
        
      - 
      
- 
        Save Xnuvers007/4baf142442860411fcb9b582baf52820 to your computer and use it in GitHub Desktop. 
    this is script for play game "guess the picture" || ini adalah script untuk memainkan permainan tebak gambar
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import axios from 'axios'; | |
| const url = 'https://raw.githubusercontent.com/BochilTeam/database/master/games/tebakgambar.json'; | |
| axios.get(url) | |
| .then(response => { | |
| const data = response.data; | |
| // Generate a random index between 0 and 999 | |
| const randomIndex = Math.floor(Math.random() * 1000); | |
| // Access the data using the random index | |
| const randomData = data[randomIndex]; | |
| // Extract the values from the randomData object | |
| const gambar = randomData.img; | |
| const deskripsi = randomData.deskripsi; | |
| const jawaban = randomData.jawaban; | |
| // Print the extracted values | |
| console.log('gambar:', gambar); | |
| console.log('deskripsi:', deskripsi); | |
| console.log('jawaban:', jawaban); | |
| // Now you can use the extracted values for further processing | |
| }) | |
| .catch(error => { | |
| console.error('Error fetching data:', error); | |
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | { | |
| "name": "tebakgambar", | |
| "version": "1.0.0", | |
| "type": "module", | |
| "description": "tebakgambar", | |
| "main": "main.js", | |
| "scripts": { | |
| "test": "node main.js" | |
| }, | |
| "author": "xnuvers007", | |
| "license": "ISC", | |
| "dependencies": { | |
| "axios": "^1.4.0" | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment