python dictionary setdefault in javascript

Solutions on MaxInterview for python dictionary setdefault in javascript by the best coders in the world

showing results for - "python dictionary setdefault in javascript"
Clement
28 May 2020
1function setDefault(obj, prop, deflt) {
2  return obj.hasOwnProperty(prop) ? obj[prop] : (obj[prop] = deflt);
3}
4