Hi, I have this JS code in a code cell and when it runs nothing happens…
%%js
// Put a zero in for the unknown value
let n1 = 1;
let d1 = 2;
let n2 = 0;
let d2 = 16;
if (n2 === 0) {
let answer = (d2 * n1) / d1;
console.log("n2 =", answer);
}
if (d2 === 0) {
let answer = (n2 * d1) / n1;
console.log("d2 =", answer);
}
I’m trying to translate that python code that work:
# Put a zero in for the unknown value
n1 = 1
d1 = 2
n2 = 0
d2 = 16
if n2==0:
answer = d2 * n1 / d1
print("n2 = ", answer)
if d2==0:
answer = n2 * d1 / n1
print("d2 = ", answer)
If you want the output to be inside a notebook you should install nodejs and a javascript kernel.
I use tslab but since jupyterlab 4 the syntax highlighting does not work anymore.
Hey @spookster! thank you so much for your answer!
I see, yes I’m getting the correct output in the console.
Now I tried to install tslab following the recommendations from the Github link: