28. Conclusion Part 2 Bug Agane


#1

hi could you tell me what is wrong in my code ??

var myKurs="10";

if("my".length===2){

    if(myKurs>=9){
        console.log=(console.log="I finished my first course!");
        
        }
    
    }
    else{console.log="I finished my first course!"}

i get error Oops, try again.
It looks like you didn't log anything!


#2

Hi @kamiln60

Try this :

var myKurs = "10";
var text = "my"; //.length method need a variable who has a string
if(text.length === 2){
    if(myKurs >= 9){
        console.log("I finished my first course!");
        }else{
            console.log("I don't finish my first course!");
    }
}

#3

A big problem there is the way you keep trying to replace the code in the built in console object's log function by assigning different values to it, these

console.log=

are all replacing the default console.log code with whatever you have put on the right hand side of the =.

To use console.log to display something in the console, you do it like this:

    console.log("Display this text");

You can restore the built in code by refreshing/reloading your web browser.