0

I am assigning a string to a javascript variable. But it generates error.

Method1

jquery = "<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js'></script>";
<!DOCTYPE html>
<html>
    <head>
          <title>old</title> 
    </head>
    <body>
    hai
    </body>
</html>

Method2

jquery = "<script src=";
                    jquery1 = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js";
                    jquery2 = "></script>";
                    console.log(jquery + jquery1 + jquery2);
<!DOCTYPE html>
<html>
    <head>
          <title>old</title> 
    </head>
    <body>
    hai
    </body>
</html>

OUTPUT

hai ";

why '";' is added after the string "hai".

How should I solve this? Please help me understand..

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Manikandan Arunachalam
  • 1,470
  • 3
  • 17
  • 32

0 Answers0