6.4 Built-in FunctionsThis chapter has focused on the use of functions that you define yourself. Bear in mind that JavaScript also provides a number of built-in functions that are part of the language. For example, the parseInt() function converts a string to an integer, and the Math.sin() function computes the sine of a number. For the most part, built-in functions behave just like user-defined functions: you can assign them to new variables, object properties, and array elements, and you can invoke them through these new variable names, properties or array elements. Practically the only discernible difference between a built-in function and a user-defined one becomes apparent when you try to print the value of a built-in function: the body of the function is replaced with the string "[native code]", indicating that the function is not itself implemented in JavaScript. |
|