I am really at the beginning with JavaScript and I am trying to assign a value of my object field. The value is coming from another object, but that value must be modified. It crashes if the value is null, so I need a try-catch block but I don't know how to do it.
var marker = new google.maps.Marker({
...
this_one: parseInt(clients[i].fields.SomeFieldOfMyObject.replace('.', '')),
...
});
I want to convert some values that might be like "54.2" to (int) 54. But there are objects that have SomeFieldOfMyObject null and my application is crashing.
I am looking for something like:
this_one: function() {
try:
return parseInt(clients[i].fields.SomeFieldOfMyObject.replace('.', ''))
catch:
return 0 }