Skip to content

Instantly share code, notes, and snippets.

@coseos
Created September 20, 2022 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coseos/67a0cc68503d37aead66efff6a3e894d to your computer and use it in GitHub Desktop.
Save coseos/67a0cc68503d37aead66efff6a3e894d to your computer and use it in GitHub Desktop.
// typelog: a simple function to log the type and value of a variable
//
// This is a short function to show the type and value of a variable that i use in my JavaScript trainings.
// It helps students to understand what they are working with in JavaScript, since JavaScript does not
// require programmers to provide the data type for a variable.
//
// Example:
//
// typelog( "A string" );
// typelog( 42 );
// typelog( 42n );
// typelog( true );
typelog = (any) => console.log( `Type is "${typeof(any)}", Value is "${any}"`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment