I'm new to JavaScript, but I come from Python and Java. I know in both of those languages, there are ways to change what the console prints when the input is an object
//Java example:
public class myClass{
public toString(){
return ("This is an object!");
}
}
myClass obj = new myClass();
System.out.println(obj); //Prints "This is an object!"
However, when I looked for an example for JS, I found that the existing toString() required me to do this every time:
Console.log(obj + '')
in order to achieve the required output, otherwise it will simply print the default object text. Is there a way I can do the same thing as in Java?