Answer in Brief
var length, breadth;
document.write("Area of triangle is"area);
The last line should be
document.write("Area of triangle is " + area);
Is there an error in this question or solution?