Mechanical engineer who dabbles with Vanilla Javscript and web development as a hobbby. I don't use any libraries or frameworks as they take the fun out creating your own solutions.
As a temporary measure for writing quicker console.log()'s just put the following in a temporary file (for polluting the global namespace) and link it to the top of your web application then unlink it when no longer needed:
constlog=(...args)=>console.log(...args);
Now you can easily do...
log(message,' : ',func.name,func(arg));ErroratnameOfFunc:undefined// example output
This is especially useful when logging multiple test cases in a single run. Similarly can be done with the other console methods. And if you really want to go crazy, this can also be done with Object.prototype.methods but you must often bind the function to the calling object's scope by setting the context with Function.prototype.bind or Function.prototype.call. I think ES5 and ES6 have made Function.prototype.apply obsolete so I don't use it or recommend it anymore. But only do this on very small projects or inside created objects.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As a temporary measure for writing quicker
console.log()
's just put the following in a temporary file (for polluting the global namespace) and link it to the top of your web application then unlink it when no longer needed:Now you can easily do...
This is especially useful when logging multiple test cases in a single run. Similarly can be done with the other console methods. And if you really want to go crazy, this can also be done with
Object.prototype.methods
but you must often bind the function to the calling object's scope by setting the context withFunction.prototype.bind
orFunction.prototype.call
. I think ES5 and ES6 have madeFunction.prototype.apply
obsolete so I don't use it or recommend it anymore. But only do this on very small projects or inside created objects.