how to return value from then function in javascript code example Example: return value from javascript function function num(x, y) { var sum = x + y; return sum; }