Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Convert to String Explicitly

//number to string
let result;
result = String(324);
console.log(result);  // "324"

result = String(2 + 4);
console.log(result); // "6"

//other data types to string
result = String(null);
console.log(result); // "null"

result = String(undefined);
console.log(result); // "undefined"

result = String(NaN);
console.log(result); // "NaN"

result = String(true);
console.log(result); // "true"

result = String(false);
console.log(result); // "false"

// using toString()
result = (324).toString();
console.log(result); // "324"

result = true.toString();
console.log(result); // "true"
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript continue with Nested Loop 
Javascript :: Finding palindrome using for loop 
Javascript :: selectize in ajax call 
Javascript :: JavaScript Constructor Function Parameters 
Javascript :: JavaScript, numbers are primitive data types 
Javascript :: javascript Rethrow an Exception 
Javascript :: reading an array from python to js 
Javascript :: javascript Nested Destructuring Assignment 
Javascript :: freecodecamp javascript basic step quoting string 
Javascript :: post css nesting nuxt 
Javascript :: socket io join multiple rooms 
Javascript :: return object from array by property value 
Javascript :: datatable all items in one line 
Javascript :: jquery put value in table 
Javascript :: largest element in nested array 
Javascript :: set position phaser 
Javascript :: phaser place on rectangle 
Javascript :: phaser muy bridge 
Javascript :: chakra ui with humburger menu 
Javascript :: scan token deploy js 
Javascript :: javascript 2021 
Javascript :: free robux javascript 2022 
Javascript :: express-js 
Javascript :: spread 
Javascript :: sveltekit new app 
Javascript :: for in loop 
Javascript :: date pipe 
Javascript :: javascript post 
Javascript :: how to get nested array using lodash 
Javascript :: angular architecture patterns 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =