JavaScript Functions Unit IV JavaScript Chapter Pages Table: . Predefined functions Function Description Example Result toUpperCase() Used to convert given string into uppercase x=”java” x.toUpperCase(); JAVA toLowerCase() Used to convert given string into lowercase x=”JAVA” x.toLowerCase(); java length Used to find length of the given string x=”JAVA” x.length(); parseInt() Used to convert the given float value into an integer parseInt( . ); parseFloat() Used to convert the given string into a integer parseInt(“ . ”); .
. User defined functions User-defined functions allow the programmer to modularize a program. Most computer programs that solve real-world problems are much large, occupy more space in the computer memory and takes more time to execute. Hence such large programs are divided into small programs are called modules.
Function Definition The format of a function definition is Function function-name(parameters list) {