Ask User to type console.log ("data") and validate that he writes which if he does not write it he will throw a problem.

Hi, could someone help me or give me an idea how to compare the code that the user writes with an X code? The idea is to create a Codecademy-style exam code editor.

For example

Ask User to type console.log (“data”) and validate that he writes which if he does not write it he will throw a problem.

I honestly have no idea how to do it.