Week 5 - Java Testing
Testing out Java with Jupyter
var bruh = "cool coding";
console.log(bruh);
function print(output) {
console.log(output)
}
print(bruh)
print(" ")
print("Can also be numbers:")
print(100)
function printType(output) {
console.log("This is a", typeof output+":", output);
}
print("You don't have to specify what type of value inputs are (string or int)")
printType("Text");
printType(bruh); // bruh = a string, therefore...
printType(100);
printType([1,2,3]); // object is generic for arrays (array = list)
function coinFlip() {
var flip = Math.random()
if(flip < "0.5") {
console.log("It's Heads!")
} else if(flip > "0.5") {
console.log("It's Tails!")
}
else {
console.log("It landed on it's side!")
// This is a 0.00000000000001% chance
}
}
var coinCount = 10
while (coinCount>0) {
coinCount=(coinCount-1);
coinFlip();
}
function htmlsource() {
// i could not figure out arrays
return (
"<head>" +
"<style>" +
"table, th, td, tr {" +
"border: 1px solid #000000;" +
"text-align: left;" +
"padding: 8px;" +
"}" +
"</style>" +
"</head>" +
"<table>" +
"<tr>" +
"<th><b>" + "Name" + "</b></th>" +
"<th><b>" + "Role" + "</b></th>" +
"</tr>" +
"<tr>" +
"<td>" + "Aiden" + "</td>" +
"<td>" + "Scrum Master" + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Dash" + "</td>" +
"<td>" + "Backend Developer" + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Sabine" + "</td>" +
"<td>" + "Frontend Developer" + "</td>" +
"</tr>" +
"<tr>" +
"<td>" + "Aiden" + "</td>" +
"<td>" + "Backend Developer" + "</td>" +
"</tr>" +
"</table>"
)
}
$$.html(htmlsource());