You are here: irt.org | FAQ | JavaScript | Object | Q1569 [ previous next ]
You can check the length of the arguments array:
<script language="JavaScript"><!-- function myObjectConstructor() { if (arguments.length < 5) { alert('Some foolish programmer did not pass 5 arguments to function myObject'); return; } } var object1 = new myObjectConstructor(1,2,3,4,5); // okay var object2 = new myObjectConstructor(1,2,3,4); // not okay //--></script>