You are here: Home / Topics / Return the Next Number from the Integer Passed in JavaScript

Return the Next Number from the Integer Passed in JavaScript

Filed under: JavaScript on 2023-08-06 20:37:49

Create a function that takes a number as an argument, increments the number by +1 and returns the result.

Examples:

addition(0) ➞ 1

addition(9) ➞ 10

addition(-3) ➞ -2

 

code: 

<script>

function addition(num){

return num+1;

}

 

addition(0) // output 1

addition(9) // output 10

addition(-3) // output -2

</script>

About Author:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.