## Topic 1 Integer Power of Numeric Value

Given a double type floating point number base and an int type integer exponent. Find the exponent of base.

## Train of thought

This problem is logically simple, but it is easy to make mistakes.

The key is to consider all aspects and all situations.

When exponent is positive, negative, and 0

Base is 0.

## Code

``````function Power(base, exponent) {
if (exponent === 0) {
return 1;
} else {
if (exponent > 0) {
var result = 1;
for (let i = 0;   i < exponent;  i++) {
result *= base;
}
return result;
} else if (exponent < 0) {
var result = 1;
for (let i = 0;   i < Math.abs(exponent);  i++) {
result *= base;
}
return result ?   1 / result : false;
}
}
}``````

## Topic 2 Adjust the array order so that odd numbers precede even numbers

Enter an integer array and implement a function to adjust the order of numbers in the array so that all odd numbers are located in the first half of the array and all even numbers are located in the second half of the array, and ensure that the relative positions between odd and odd numbers, even and even numbers remain unchanged.

## Code

``````function reOrderArray(array) {
var odd = [];
var even = [];
for (var i = 0;   i < array.length;  i++) {
const element = array[i];
if (element === 0 || element % 2 === 0) {
even.push(element);
} else {
odd.push(element);
}
}
return odd.concat(even);
}``````