get gcf javascriot
const gcd = (a, b) => b === 0 ? a : gcd(b, a % b);
// Example
gcd(10, 15); // 5function gcd_two_numbers(x, y) {
if ((typeof x !== 'number') || (typeof y !== 'number'))
return false;
x = Math.abs(x);
y = Math.abs(y);
while(y) {
var t = y;
y = x % y;
x = t;
}
return x;
}
console.log(gcd_two_numbers(12, 13));
console.log(gcd_two_numbers(9, 3));
Also in JavaScript:
- jquery loop through li element
- clean collection mongoose
- number counter html
- mixin in styled components
- how to do radio button validation in jquery
- jQuery change select value
- What does ~~ (“double tilde”) do in Javascript?
- js read a ini file
- route parammap subscribe angular 9
- angular input value
- remove non alphanumeric characters javascript
- jquery scroll to id
- remove a class after 100 milliseconds jquery
- js delete all array items
- get variable name javascript
- javascript string interpolation
- jquery clear form values
- jwt refresh token
- reload page javascript
- how to split two digit number in javascript
- javascript fetch json
- dynamically add images to carousel
- load jquery in the browser code
- nodejs fs create file if not exists