function call(a, b)

{

var intA = parseInt(a);

var intB = parseInt(b);

if(isNaN(intA) || isNaN(intB))

{

document.write("Not integer number : " + intA + ", " + intB + "<br>" );

}

else

{

document.write("Sum : " + (intA + intB));

}

}


document.write("call(a, b) => " );

call('a', 'b');

document.write("call(5, 7) => " );

call(5, 7);

 

 document.write("<br><br>");

 

 var StrBuffer = function()

 {

var buffer = [];

 

this.append = function(str)

{

buffer.push(str);

}

this.toString = function()

{

return buffer.join(' ');

}

 }

 

 var strBuff = new StrBuffer();

 strBuff.append('Hello');

 strBuff.append('Javascript');

 document.write(strBuff);


5-2_Function.js


반응형

'Programming > JavaScript' 카테고리의 다른 글

[JavaScript] 5-3_simulation.js  (0) 2016.12.07
[JavaScript] 5-3_SimpleOOPinJavaScript.html  (0) 2016.12.07
[JavaScript] 5-1_OOPBasic.js  (0) 2016.12.07
[JavaScript] 5-0_OOPinJavaScript.html  (0) 2016.12.07
[JavaScript] 3-5_evalFunc.js  (0) 2016.12.07

+ Recent posts