I can see a couple of problems related to the code. I put comments to your code, so you can check why it does not work.
let numbers = [1,2,3,4,5,6,7,8,9,10]
// The initial value for e is not defined so first read from the
// array will look like "numbers[undefined]"
let e;
// The "sort" is called before it's declared, so this might cause
// problems.
// Also passing callback to the forEach function should look like this
// numbers.forEach(sort). When calling forEach(sort()) you're trying
// to pass a result of the sort() function to forEach which will be
// undefined.
let no = numbers.forEach(sort());
function sort() {
// The "e" variable is not initialized and not incremented anywhere
// so this will not work at all.
if(numbers[e] % 2 === 0) {
console.log(`${numbers[e]} is even`);
// This piece overwrites content of the HTML tag each time
// it's called. You need to append to the content.
// document.querySelector("#even").innerHTML = numbers[e];
} else {
console.log(`${numbers[e]} is odd`);
// This is affected by the same issue as writing to the
// #even tag.
// document.querySelector("#odd").innerHTML = numbers[e];
}
}
Working solution for your problem might look like this
HTML
<div id="even"> Even numbers: </div>
<div id="odd"> Odd numbers: </div>
and JavaScript
let numbers = [1, 2, 3, 4, 5 ,6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
function sort(item) {
// Here you can check if number is even or odd
// and decide which HTML element should be updated
// in just a single line.
let tagId = item % 2 === 0 ? "even" : "odd";
// And here you just updated HTML tag with extra content
// by appending next numbers separated by a space.
document.getElementById(tagId).insertAdjacentHTML('beforeend', item + " ");
}
numbers.forEach(sort);