Uncaught TypeError: Cannot read properties of undefined (reading '500')

html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    
  </head>
  <body>
<input  id= "number"></input>
<button id= "convert-btn">Convert</button>
<div id= "output"></div>
<script src= "./script.js"></script>
  </body>
</html>

const inputNumber = document.getElementById("number");
const convert = document.getElementById("convert-btn");
const outputElement = document.getElementById("output");

const numeral = [
  ["M", 1000]
  ["CM", 900]
  ["D", 500]
  ["CD", 400]
  ["C", 100]
  ["XC", 90]
  ["L", 50]
  ["XL", 40]
  ["X", 10]
  ["IX", 9]
  ["V", 5]
  ["IV", 4]
  ["I", 1]
];

input.addEventListner("keydown", e => {
  if(e.key === "Enter"){
    convert.click()
  }
})

convert.addEventListener("click", () => {
const value = input.value;
if(!value) {
  output.innerText = "Please enter a valid number"
} else if(value < 0){
  output.innerText = "Please enter a number greater than or equal to 1"
} else if(value > 3999){
  output.innerText = "Please enter a number less than or equal to 3999"
  }
})

Can you post all of your code and a link to the challenge?
Note: The error message you’re encountering, “Uncaught TypeError: Cannot read properties of undefined (reading ‘500’)”, typically occurs when you try to access a property of an object that is undefined

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="./styles.css">
    
  </head>
  <body>
<input  id= "number"></input>
<button id= "convert-btn">Convert</button>
<div id= "output"></div>
<script src= "./script.js"></script>
  </body>
</html>

this the rest of it this the roman numeral project the error starter once i coded convert.addListener and down

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Your code has several issues

Array items should have a comma after each one

You misspelled listener

You never define input anywhere in your code. Look at the variables you declared

That is an interesting error message.

  1. It will use the last element of the accessor array.
[1,2,3][0,2] // 3
// same as
[1,2,3][2] // 3
  1. With that in mind, we can see that this is undefined (["M", 1000] at index 900)
["M", 1000]["CM", 900] // undefined
// same as
["M", 1000][900] // undefined
  1. The next step is to access undefined using ["D", 500] (so index 500 into undefined)
["M", 1000]["CM", 900]["D", 500] // Uncaught TypeError: Cannot read properties of undefined (reading '500')
// same as
undefined[500]

That is how I understand it anyway. Perfectly normal…nothing to see here.

thanks i been up since last night a little brain dead lol