0

Hi I really new with this and have run into a hiccup. i am passing information to a class, and need to use the information i pass to create a new DOM Element using a template literal.

essentially...

 const animeBlock = document.querySelector(".anime_block")

const fruity = ` <div classid > 
     <h1> ${name}</h1>
     <h1> ${aut}</h1>
      etc. 

class anime{ 
   constructor(name, aut, rel, stat, plot, main){
      this.name = name;
      etc.
   }

 bringBack(){
 animeBlock.insertAdjacentHTML("afterbegin", fruity)
 }

how do i use the information from the instance into the template literal (fruity).

Thank you in advance,

any information is greatly appreciated.

  • Move the template literal *inside* the class method and use `this.…` to refer to the properties. – Bergi May 30 '22 at 20:09

0 Answers0