Created
September 26, 2018 08:25
-
-
Save MirzaChilman/ecb6cf54d106ac372fc27d311119d61e to your computer and use it in GitHub Desktop.
Latihan test kerja 1
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function test(i) { | |
const text1 = 'Codility' | |
const text2 = 'Test' | |
const text3 = 'Coders' | |
for(let n=1; n< i;n++){ | |
if(n % 5 === 0 && n % 3 === 0 && n % 2 === 0 ){ | |
console.log(text1+text2+text3) | |
}else if(n % 5 === 0 && n % 3 === 0){ | |
console.log(text2+text3) | |
}else if(n%3 === 0 && n%2 === 0){ | |
console.log(text1+text2) | |
}else if(n%2 === 0 && n%5 === 0){ | |
console.log(text1+text3) | |
}else if(n % 2 === 0){ | |
console.log(text1) | |
}else if(n % 3 === 0){ | |
console.log(text2) | |
}else if(n % 5 === 0){ | |
console.log(text3) | |
}else { | |
console.log(n) | |
} | |
} | |
} | |
test(24) | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function test(i) { | |
const text1 = 'Codility' | |
const text2 = 'Test' | |
const text3 = 'Coders' | |
for(let n=1; n< i;n++){ | |
if(n % 5 === 0 && n % 3 === 0 && n % 2 === 0 ){ | |
console.log(text1+text2+text3) | |
}else if(n % 5 === 0 && n % 3 === 0){ | |
console.log(text2+text3) | |
}else if(n%3 === 0 && n%2 === 0){ | |
console.log(text1+text2) | |
}else if(n%2 === 0 && n%5 === 0){ | |
console.log(text1+text3) | |
}else if(n % 2 === 0){ | |
console.log(text1) | |
}else if(n % 3 === 0){ | |
console.log(text2) | |
}else if(n % 5 === 0){ | |
console.log(text3) | |
}else { | |
console.log(n) | |
} | |
} | |
} | |
test(24) | |
</script></body> | |
</html> |
This file contains 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
function test(i) { | |
const text1 = 'Codility' | |
const text2 = 'Test' | |
const text3 = 'Coders' | |
for(let n=1; n< i;n++){ | |
if(n % 5 === 0 && n % 3 === 0 && n % 2 === 0 ){ | |
console.log(text1+text2+text3) | |
}else if(n % 5 === 0 && n % 3 === 0){ | |
console.log(text2+text3) | |
}else if(n%3 === 0 && n%2 === 0){ | |
console.log(text1+text2) | |
}else if(n%2 === 0 && n%5 === 0){ | |
console.log(text1+text3) | |
}else if(n % 2 === 0){ | |
console.log(text1) | |
}else if(n % 3 === 0){ | |
console.log(text2) | |
}else if(n % 5 === 0){ | |
console.log(text3) | |
}else { | |
console.log(n) | |
} | |
} | |
} | |
test(24) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment