Sum characters and compare.
charCodeAt
reduce
function isValid(data, sum) { return data.split('').reduce((a, c) => a + c.charCodeAt(0), 0) === sum; }