JavaScript Demonstration
Demonstration of the JavaScript kernel working in a Jupyter Notebook
var Letters = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"];
var numbers = ["1", "2", "3", "4", "5"];
var rLetters = Math.floor(Math.random()*Letters.length);
var rNumbers = Math.floor(Math.random()*numbers.length);
var user = Letters[rLetters] + numbers[rNumbers];
console.log (user);
// Defining variable team
var team = {
Haseeb: "h4seeb-cmd",
Shaurya: "STG-7",
Tirth: "Tirth-Thakkar",
Evan: "chewy-boba10",
Alex: "YLu-1258"
};
// Creating the function to make the table
function createTable(values){
var table = "<table><tr><th>Name</th><th>GitHub Username</th></tr>"
var keys = Object.keys(values);
// Printing the values into the table
for(var index in keys){
const key = keys[index];
const value = team[key];
table += "<tr><td>"+key+"</td><td>"+value+"</td></tr>";
}
table += "</table>";
return table;
}
$$.html(createTable(team));