Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Simple code example of adding two numbers in javascript

<script>
function addNumbers(a, b) {  
    return a + b;  
}  
var sum = addNumbers(15, 25);  
document.write('Sum of the numbers is: ' + sum); 
</script>
Comment

javascript Function Add Two Numbers

// program to add two numbers using a function
// declaring a function
function add(a, b) {
    console.log(a + b);
}

// calling functions
add(3,4);
add(2,9);
Comment

javascript function add two numbers

//Simple Function to add two numbers
const addTwoNums = (num1, num2) => {
    let sum = num1 + num2;
    return sum
}
console.log(addTwoNums(60, 9)) //function call and log the answer to the console
Comment

PREVIOUS NEXT
Code Example
Javascript :: js make id 
Javascript :: chart js change axis label 
Javascript :: javascript how to sort alphabetically 
Javascript :: set dynamic route in link react js 
Javascript :: npm execute script with nodemon 
Javascript :: ternary operator react 
Javascript :: header logo react native img 
Javascript :: ajax file form 
Javascript :: stop a function javascript 
Javascript :: javascript number format 
Javascript :: how to concatenate strings javascript 
Javascript :: how to format an integer with a comma in javascript 
Javascript :: discord.js how to send message 
Javascript :: javascript regex example match 
Javascript :: spawn template playcanvas 
Javascript :: javascript get multiple elements by id 
Javascript :: how to find the last word of a string in javascript 
Javascript :: elasticsearch aggregation unique values 
Javascript :: Add an element to an array at a specific index with JavaScript 
Javascript :: promisify 
Javascript :: add items to a list in a document monoose 
Javascript :: .toJSON() in sequelize 
Javascript :: import bootstrap in react 
Javascript :: js function string parameter 
Javascript :: json query online 
Javascript :: var notification = new Notification 
Javascript :: js string count 
Javascript :: check if isset variable js 
Javascript :: jquery chek radio 
Javascript :: object values 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =