Skip to content

Instantly share code, notes, and snippets.

@paulmwatson
Created January 18, 2021 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulmwatson/e02fb3d0533f59fe9f3f7e1e6b766adb to your computer and use it in GitHub Desktop.
Save paulmwatson/e02fb3d0533f59fe9f3f7e1e6b766adb to your computer and use it in GitHub Desktop.
Comparing squaring.
//example1.js
const func1 = (foo, bar)=> {
const num1 = Math.pow(foo, 2)
const num2 = Math.pow(bar, 2)
}
//example2.js
const func1 = (foo, bar)=> {
const num1 = foo **2
const num2 = bar **2
}
//example1.js
const square = (data) => data * data
...
const func1 = (foo, bar)=> {
const num1 = square(foo)
const num2 = square(bar)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment