# Treehugger.js demo

This demo shows Javascript to the left, its Abstract Syntax Tree in the middle, and the output of a value inference on the right. Move your cursor on a variable in the code view to infer the type/value of the variable (result appears in the analysis view).

Javascript | AST | Analysis
--- | --- | ---

var a = 10; var s = "hello"; console.log(a, s); function giveBack(value) { return value; } var a2 = giveBack(a); var s2 = giveBack(s); console.log(a2, s2); function Person(name, age) { this.name = name; this.age = age; } var p = new Person("Zef", 27); console.log(p.name, p.age); var obj = {}; obj.name = "Zef"; obj.address = {}; obj.address.street = "Zef St."; obj.address.number = 22; /* Person.prototype.getName = function() { return this.name; } Person.prototype.getAge = function() { return this.age; } var p = new Person("Zef"); var nam = p.getName(); var ag = p.getAge(); */