Skip to content

Instantly share code, notes, and snippets.

View debugmodedotnet's full-sized avatar

Dhananjay Kumar debugmodedotnet

View GitHub Profile
<div ng-controller="authorController" >
{{author.name}} is {{author.age}} old
</div>
@debugmodedotnet
debugmodedotnet / JSFunction.js
Last active August 29, 2015 14:14
Create JavaScript function
var add = function Add(num1, num2)
{
var result = num1 + num2;
return result;
};
var add = function Add(num1, num2)
{
var result = num1 + num2;
return result;
};
var s = add(34, 67);
console.log(s);
var sub = function (num1, num2)
{
var result = num1 - num2;
return result;
};
var r = sub(5, 9);
console.log(r);
var s = sub(34, 67);
console.log(s);
var sub = function (num1, num2)
{
var result = num1 - num2;
return result;
};
function Factorial(n)
{
if (n <= 1) {
return 1;
}
return n * Factorial(n - 1);
}
var result = Add(9, 8);
console.log(result);
function Add(num1, num2)
{
return num1 + num2;
}
function Add(num1, num2)
{
return num1 + num2;
}
var result = Add(1, 2);
console.log(result);
function Foo()
{
// function body
}
var result = Foo();
console.log(result);
function Foo()
{
// function body
return;
}
var result = Foo();
console.log(result);