Created
May 27, 2023 07:41
-
-
Save ozmos/c6c0b7606ac6c29a29ae03b2adc43b43 to your computer and use it in GitHub Desktop.
Find exponent of imaginary number in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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