33

console.log("debug");
.
.
.
console.log("debug1");
.
.
.
console.log("debug2");
- The only way. Try to change my mind

Comments
  • 17
    This is the way
  • 14
    Or for the back end devs...

    <?php echo '<script>console.log("debug");</script>'; ?>
  • 6
    @HiFiWiFiSciFi omfg I love that haha
  • 2
    "debugger;" + F12 ❤️
  • 1
    unless the app you're working on already has like 10 console.debug-s per second, and you're working on a part that's sending notifications into chat window, so you can do chatWindow.sendMessage (or whatever it's called in your app) instead, to actually be able to notice those messages.
  • 1
    Many ways to rome but this is one:
    ```
    let nr = 1

    console.info(nr++)
    console.info('waaa')
    console.info(nr++)
    ```
    Or even better:
    ```
    class Logger {
    _nr = 0
    _loggerName = 'default'
    constructor(name){
    this._loggerName = name

    }
    warn(){
    console.warn(this._loggerName, this._nr++, arguments)
    }
    info(){
    console.info(this._loggerName, this._nr++, arguments)
    }
    }

    const z = new Logger('My Z Loggerr!!')
    z.warn('It','is','incrementing and shows the logger name')
    z.info('It','is','incrementing and shows the logger name')
    ```
    Bit python style

    Edit: how to show proper code indenting around here? Wasn't there a bot for that?
  • 0
    Browser debuggers are still crap in many situations. My webpack creates several different versions of each file, sometimes in the wrong directories
  • 1
    Vs code debugger for chrome is love
  • 3
    You do know that Chrome supports break points, right?
    Tho I also think that this is the way. 🙃
  • 0
    @ostream Vue
  • 0
    Currently, brain transplant is not possible
    Sorry for PJ
  • 1
  • 2
    @Folkmann Haha, the moment i realize i need breakpoints to figure out the issue - i realize that probably my code is too fucked already.

    On topic: it is for me the way as well.

    Off topic: it's a shame that i learned console.table so late. It's catshit awesome!
  • 0
    Console.log(1)...
  • 0
    Or use a good IDE and just put a breakpoint....
  • 1
    @ostream Well you can run bare feet, but it’s more comfortable with shoes.
    100mo ? my IDE eats around 1.5 GB of RAM (For big projects) and still it’s faster to put a breakpoint than try do debug with console.log 😊
Add Comment