Skip to content

Commit

Permalink
Add convertYardsToMeters in javascript (#1137)
Browse files Browse the repository at this point in the history
  • Loading branch information
gballesteros10 authored and t2013anurag committed Oct 24, 2017
1 parent 610b260 commit dd86a99
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions conversions/length/convertYardsToMeters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/* Convert yards to meters where 1 yard equals ~0.9144 (or 36/39.370113 to be more precise) meters */

function convertYardsToMeters(yards) {
if (typeof yards != "number")
throw new Error("Invalid Type");
return yards * 36 / 39.370113;
}

console.log(convertYardsToMeters(1));

0 comments on commit dd86a99

Please sign in to comment.