fork download
  1. // your code goes here
  2. const soal5 = () => {
  3. const target = peta[0][3];
  4. while (ditemukan === false) {
  5. for (let i = 0; i < peta.length; i++) {
  6. for (let j = 0; j < peta[i].length; j++) {
  7. console.log(peta[i][j]);
  8. if (peta[i][j] === target) {
  9. ditemukan = true;
  10. console.log("ditemukan");
  11. }
  12. }
  13. }
  14. }
  15. };
  16. console.log(soal5);
Success #stdin #stdout 0.04s 16696KB
stdin
Standard input is empty
stdout
() => {
  const target = peta[0][3];
  while (ditemukan === false) {
    for (let i = 0; i < peta.length; i++) {
      for (let j = 0; j < peta[i].length; j++) {
        console.log(peta[i][j]);
        if (peta[i][j] === target) {
          ditemukan = true;
          console.log("ditemukan");
        }
      }
    }
  }
}