Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript gcd

const gcd = (a, b) => b === 0 ? a : gcd(b, a % b);

// Example
gcd(10, 15);    // 5
Comment

gcd using js

function gcd(a, b) {
    if (a == 0)
        return b;
    return gcd(b % a, a);
}

console.log(gcd(24, 30)) // 6
console.log(24 / 6, 30 / 6) // 4 5
//////////////////
//				//
//  4 * 6 = 24  //
//  5 * 6 = 30  //
//              //
//////////////////
Comment

PREVIOUS NEXT
Code Example
Javascript :: searchable 
Javascript :: Plumsail change the size of the dialog window 
Javascript :: p5.js sketch 
Javascript :: Plumasil - new item button text 
Javascript :: terraform for loop json 
Javascript :: react-folder tree example 
Javascript :: mongoose.js clause where 
Javascript :: Number o flines of typography element react material 
Javascript :: json format in .net core 
Javascript :: javascript Change color based on a keys value in each object of array 
Javascript :: Angular /Javascript- How can I shrink Sticky header on scroll functionality 
Javascript :: getting json from response using getSync method 
Javascript :: Changing the value of a dropdown when the value of a number box changes in AngularJS 
Javascript :: call method from parent 
Javascript :: Angularjs onchange datetime picker not working 
Javascript :: List of data with buttons that should display the rest of the data below 
Javascript :: How to add the items from a array of JSON objects to an array in Reducer 
Javascript :: Extract and convert from JSON by Regex 
Javascript :: JSON.stringify on Arrays adding numeric keys for each array value 
Javascript :: Node.js with Express: Importing client-side javascript using script tags in Jade views 
Javascript :: convert json to string curl 
Javascript :: javascript get elemet last of array 
Javascript :: javascript assignment by reference or value 
Javascript :: angular error handling 
Javascript :: how to add random color in chart in react j 
Javascript :: map sord elo 
Javascript :: Object.entries() For A JSON 
Javascript :: nesjs rest api 
Javascript :: javascrit loop array 
Javascript :: javascript check if array has at least one true value 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =