Programming-Idioms

Implementation
JS

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another JS implementation.

Other implementations
import "reflect"
fmt.Println(reflect.TypeOf(x))
print ref($x)||"SCALAR", "\n";
print(type(x))
import std.stdio: writeln;
writeln(typeid(x));
import Data.Dynamic
print (dynTypeRep (toDyn x))
int a = 0;
String b = "str";
System.out.println(((Object)a).getClass().getName());
System.out.println(b.getClass().getName());
System.Console.WriteLine(x.GetType());
echo is_object($x) ? get_class($x) : gettype($x);
puts x.class
print(type(x))
print(x.__class__)
#![feature(core_intrinsics)]
fn type_of<T>(_: &T) -> &'static str {
    unsafe { std::intrinsics::type_name::<T>() }
}

println!("{}", type_of(&x));
fmt.Printf("%T", x)
print(x.runtimeType);
console.log (typeof x);
#include <typeinfo>
std::cout<<typeid(x).name();
(type x)