You don't need to get the character for those key codes, you could just compare them directly:
function keyDown(e) {
if (e.keyCode === 37) isLeft = true;
if (e.keyCode === 39) isRight = true;
}
function keyUp(e) {
if (e.keyCode === 37) isLeft = false;
if (e.keyCode === 39) isRight = false;
}
Anyway, keep in mind e.keyCode is deprecated, so e.key or e.code should be used instead, which also makes the code easier to understand. Also, you could use an object with boolean properties instead of individual booleans to make this scale better to more keys:
const pressedKeys = {};
document.onkeydown = ({ key }) => {
pressedKeys[key] = true;
console.log(Object.keys(pressedKeys).join(' + '));
};
document.onkeyup = ({ key }) => {
delete pressedKeys[key];
console.log(Object.keys(pressedKeys).join(' + '));
};
Just keep in mind some old browsers used non-standard codes, so left is usually 'LeftArrow ' and right is 'RightArrow', but on IE it's just 'Left' and 'Right' instead.
Also, if you need to check KeyboardEvent's properties values such as e.key, e.code, e.which or e.keyCode you can use https://keyjs.dev. I will add information about these kinds of cross-browser incompatibilities soon!

Disclaimer: I'm the author.