Why does 'false' show up on the console every time I run this program?



Whenever I hit save&submit code, 'false' is displayed on the console. The program works fine, but console.log("false") isn't written anywhere in my code. Why is it showing up and how do I hide it?

var slaying = true
var youHit = Math.floor(Math.random() * 2)
var damageThisRound = Math.floor(Math.random() * 5 + 1)
var totalDamage = 0

while(slaying) {
    if (youHit === 1) {
        console.log("You shoot the dragon with a pistol.")
        totalDamage = totalDamage += damageThisRound;
        if (totalDamage >= 4) {
            console.log("You pwned that dragon n00b.")
        else {
    else {
        console.log("Get rekt")
    slaying = false


This is normal behaviour for Javascript; the last defined value of a function or statement (if nothing is returned) is printed to the console for debugging purposes.

In this case, it's where you have defined slaying = false.