Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to replace empty string with undefined

var ab = {
firstName : undefined,
lastName : undefined
}

let newJSON = JSON.stringify(ab, function (key, value) {return (value === "") ? undefined : value});

console.log(JSON.parse(newJSON))
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery append to table 
Javascript :: express cors specific origins 
Javascript :: JavaScript Split the string into an array of characters 
Javascript :: aggregate mongodb 
Javascript :: javascript fill circle with color 
Javascript :: javascript input 
Javascript :: jsx inline style 
Javascript :: change url link javascript 
Javascript :: how to stop type text texbox in javascript 
Javascript :: enable vue devtools 
Javascript :: convert a string to array in javascript 
Javascript :: Error: ENOENT: no such file or directory, mkdir 
Javascript :: extend javascript 
Javascript :: how to make a preloader dissapear in html 
Javascript :: js get integer value of 
Javascript :: node-json-db 
Javascript :: javascript find in nested array 
Javascript :: get in redis 
Javascript :: js === 
Javascript :: node js vs jquery 
Javascript :: new Date().now 
Javascript :: node get current user 
Javascript :: How to make remove buttoon on table using js DOM 
Javascript :: execute command javascript 
Javascript :: make angular to run on a different port 
Javascript :: why to use event.persist 
Javascript :: new map js 
Javascript :: link to website electron 
Javascript :: async await iife 
Javascript :: TYPING TEXT USING JS 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =