How do I format a code block in markdown?

I get a response from the server which is in a string format, I want to render it with the proper formatting for that language, and not be a single line code.

the response from the server

let response = “function hero(){ console.log(“Hello, world!”); }” [contains back thick at the beginning and end]

I want it to be rendered with formatting like this:

function hero(){
    console.log("Hello, world!");
}

Any comment or advice is appreciated