Created
September 20, 2022 08:07
-
-
Save coseos/67a0cc68503d37aead66efff6a3e894d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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