console.log function like so:
console.log( 'My message' );
Or if you want to include a message and variable, in this case display the contents of settings variable:
console.log( 'Settings value:', settings );
wp.data.select( 'core/block-editor' ).getBlockCount();
If you would like to pause code execution at a certain line of code, you can write
debugger; anywhere in your code. Once the browser sees the statement
debugger;, it will pause execution of your code. This allows you to inspect all variables around the
debugger statement, which is very useful. See this MDN page for more information.
myguten.js and confirm it is being loaded.
If you do not see the file being loaded, double check the enqueue function is correct. You can also check your server logs to see if there is an error messages.
myguten.js script is enqueued without declaring the
wp-blocks dependency, the console log will show:
You can correct by checking your
wp_enqueue_script function includes all packages listed that are used:
wp_enqueue_script( 'myguten-script', plugins_url( 'myguten.js', __FILE__ ), array( 'wp-blocks' ) );