lundi 1 décembre 2014

Java to check javascript code if it has any error or not


I am dynamically creating a Javascript code in java. Now I want to check if it has any error or not. Any idea or suggestion would be a great help.


The code that i am creating is something like:



var a1 = "myName";
var myArray = ["a1", "a2", "a3"];

var collections = [
{name: "name1", art: "gallery", description: "my description text goes here. and this description can have any type of quotes, like single quote, double quote."},
{name: "name1", art: "gallery", description: "my description text goes here. and this description can have any type of quotes, like single quote, double quote."}
];


All the values are dynamic that are written in java. and the array can be of any length. I want to make sure that no other characters are added like of being double inverted comma in between description which will cause error. I don't want to write code before to check every string.


after writing javascript code, I want to check if this javascript has error or not only.


Any help would be great. Thanks





Aucun commentaire:

Enregistrer un commentaire