Skip to content

Instantly share code, notes, and snippets.

@ozmos
Created May 27, 2023 07:41
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 ozmos/c6c0b7606ac6c29a29ae03b2adc43b43 to your computer and use it in GitHub Desktop.
Save ozmos/c6c0b7606ac6c29a29ae03b2adc43b43 to your computer and use it in GitHub Desktop.
Find exponent of imaginary number in JavaScript
function imaginaryExponent(exponent) {
switch(exponent % 4) {
case 1:
return 'i';
break;
case 2:
return -1;
break;
case 3:
return '-i';
break;
case 4:
return 1;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment