This page documents data types appearing in Klevu JS Lib function signatures, whether defined by JavaScript itself or further restricted by Klevu JS Lib. Unless explicitly stated otherwise, Klevu JS Lib functions require primitive values where applicable, and do not accept their Object-wrapped forms. If you want to study these concepts in depth, take a look at MDN.

You should be able to try out most of the examples below by just copying them to your browser’s JavaScript Console.

Whenever an example mentions that a type defaults to a boolean value, the result is good to know when using that type in a boolean context:

var x = "";
if ( x ) {
  console.log( "x defaulted to true" );
} else {
  console.log( "x defaulted to false" );

In this case, "x defaulted to false" is printed.


A boolean in JavaScript can be either true or false:

if ( true ) console.log( “always!” );
if ( true ) console.log( “always!” );


Everything in JavaScript is an object, the easiest way to create an object is the object literal:

var x = {};
var y = {
  name: "Pete",
  age: 15

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>