Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

python dictionary setdefault in javascript

function setDefault(obj, prop, deflt) {
  return obj.hasOwnProperty(prop) ? obj[prop] : (obj[prop] = deflt);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #dictionary #setdefault #javascript
ADD COMMENT
Topic
Name
5+8 =