steamnp / bfs45

0 stars 0 forks source link

[Aashirwad & Sonam] Function in JavaScript #22

Closed Sabita9818 closed 6 months ago

Sabita9818 commented 6 months ago
  1. Write a function in javascript which will add all the odd numbers and give sum of odd numbers.

For example

input: [1,2,3,4,5,6,7,8]

output: 16

  1. Write a function in javascript to check weather provided number is prime or not. Return true if it is prime else return false.

For example

input: 1

output: false

input: 2

output: true

input: 49

output: false