JSFiddle - React, Tailwind, and code Playground

by dshilkret

JavaScript

let value = "123.45"; // Example value as a string
let doubleValue = parseFloat(value);

if (!isNaN(doubleValue)) {
    // Proceed with the API call using doubleValue
    console.log("Converted value:", doubleValue);
} else {
    console.error("Value cannot be converted to a double:", value);
}

// String
let stringExample = "Hello, world!";

// Number
let numberExample = 42;

// Boolean
let booleanExample = true;

// Undefined
let undefinedExample;

// Null
let nullExample = null;

// Symbol
let symbolExample = Symbol('unique');

// BigInt
let bigIntExample = 1234567890123456789012345678901234567890n;

console.log(typeof stringExample); // "string"
console.log(typeof numberExample); // "number"
console.log(typeof booleanExample); // "boolean"
console.log(typeof undefinedExample); // "undefined"
console.log(typeof nullExample); // "object" (this is a quirk in JavaScript)
console.log(typeof symbolExample); // "symbol"
console.log(typeof bigIntExample); // "bigint"