You can simply combine the printf
and json_encode
function to make this.
function console_log($data) {
printf('<script>console.log(%s);</script>', json_encode($data));
}
console_log(['name' => 'Wallace Maxters']);
Output:
For further actions, you may consider blocking this person and/or reporting abuse
Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.
Joaquín Gutiérrez -
Joaquín Gutiérrez -
Joaquín Gutiérrez -
Prince -
Top comments (0)