Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sum.js 423B

12345678910111213141516
  1. /* public/sum.js */
  2. function sum() {
  3. // Convert arguments object to array
  4. var args = Array.prototype.slice.call(arguments);
  5. // Throw error if arguments contain non-finite number values
  6. if (!args.every(Number.isFinite)) {
  7. throw new TypeError('sum() expects only numbers.')
  8. }
  9. // Return the sum of the arguments
  10. return args.reduce(function(a, b) {
  11. return a + b
  12. }, 0);
  13. }