Preview:
function add (string) {
   let partsArray = string.split("+");
   console.log("parts", partsArray);
   let added = 0;
      
   for (let i=0; i<partsArray.length; i++) {
      console.log("i",parseInt(partsArray[i]));
      added += parseInt(partsArray[i]);
   }

   return added;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter