Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

';' expected. | document.body.style.background-image = “

Here is my code:
code

 function toggle() {
     document.body.style.background-image = `
     linear-gradient(
      60deg,
      hsl(0deg 0% 0%) 0%,
      hsl(137deg 0% 1%) 0%,
      hsl(137deg 0% 2%) 0%,
      hsl(137deg 0% 4%) 2%,
      hsl(137deg 0% 5%) 5%,
      hsl(137deg 0% 5%) 10%,
      hsl(137deg 0% 6%) 19%,
      hsl(137deg 0% 6%) 42%,
      hsl(261deg 17% 14%) 88%,
      hsl(259deg 25% 27%) 97%,
      hsl(258deg 28% 40%) 100%,
      hsl(258deg 36% 54%) 100%
    );`;
  }

I am getting an error on line 43 saying

‘;’ expected.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I dont know why and I doubt its an issue with the backticks. Any help would be greatly appreciated.

>Solution :

Its backgroundImage, not background-image

function toggle() {
    document.body.style.backgroundImage = `
    linear-gradient(
      60deg,
      hsl(0deg 0% 0%) 0%,
      hsl(137deg 0% 1%) 0%,
      hsl(137deg 0% 2%) 0%,
      hsl(137deg 0% 4%) 2%,
      hsl(137deg 0% 5%) 5%,
      hsl(137deg 0% 5%) 10%,
      hsl(137deg 0% 6%) 19%,
      hsl(137deg 0% 6%) 42%,
      hsl(261deg 17% 14%) 88%,
      hsl(259deg 25% 27%) 97%,
      hsl(258deg 28% 40%) 100%,
      hsl(258deg 36% 54%) 100%
    )
    `;
  }
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading