function test1() { var a = 1; var b = 2; function test2() { var c = 3; var d = 4; return = c + d; } var sum = a + b + test2(); alert(sum); }