XML is often used to represent “raw” data. JavaScript on the otherhand, is a part of content-rendering language more specifically designed for presentation of the data . JavaScript can only use “allowed” keywords on the otherhand in XML you can define your own tags which makes it more flexible than JavaScript.