Summing the numeric characters in a string

I’m seriously challenged this evening :face_with_hand_over_mouth: . I’m trying to take a string of characters, ignoring any non numeric characters and adding the numeric characters. That bit works, but then I want to take the resultant number string and add those numbers up. But that is giving me Not a Number. It must be something daft I am (not) doing. Here’s my Codepen:

Let me get this straight. You want it so that if I entered “abc123abc123” the total would be 12 and total2 would be 3?

V/r,

^ _ ^

Yup, that’s it!

Here you go. :slight_smile:

https://codepen.io/anon/pen/rQqZKY

V/r,

^ _ ^

Thank you squire. You are a gent!

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.