1.

Why do we use document.write() in JavaScript?

Answer»

Unfortunately, Boolean Typed ARRAY do not exist in JavaScript. The following typed arrays exist in JavaScript: Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, etc.

Let us see an EXAMPLE of Int8Array typed array. The Int8Array typed array REPRESENTS an array of twos-complement 8-bit signed integers.

The following is the syntax:

new Int8Array(); new Int8Array(length); new Int8Array(typedArray);

The following is an example: 

<!DOCTYPE html> <html> <body> <SCRIPT>   var val = new Int8Array(5);   val[3] = 9;   // length of array   document.write("Array Length  = "+val.length);   // displaying array elements   document.write("<br>Array elements...");   document.write("<br>"+val[0]);   document.write("<br>"+val[1]);   document.write("<br>"+val[2]);   document.write("<br>"+val[3]); </script> </body> </html>

The output:

Array Length = 5 Array elements... 0 0 0 9


Discussion

No Comment Found