
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What is the difference between custom and built-in functions in JavaScript?
The custom functions in JavaScript are user-defined functions. JavaScript allows us to write our own functions. The following is the syntax −
Syntax
<script> <!-- function functionname(parameter-list) { statements } //--> </script>
Bult-in functions are functions already provided by JavaScript library, for example, the following are string functions −
S. No | Method & Description |
---|---|
1 | charAt() Returns the character at the specified index. |
2 | charCodeAt() Returns a number indicating the Unicode value of the character at the given index. |
3 | concat() Combines the text of two strings and returns a new string. |
4 | indexOf() Returns the index within the calling String object of the first occurrence of the specified value, or -1 if not found. |
Example
The following is an example of a built-in function in JavaScript to concatenate strings −
<html> <head> <title>JavaScript String concat() Method</title> </head> <body> <script> var str1 = new String( "This is string one" ); var str2 = new String( "This is string two" ); var str3 = str1.concat( str2 ); document.write("Concatenated String :" + str3); </script> </body> </html>
Output
- Related Articles
- What is the difference between functions and methods in JavaScript?
- What is the difference between anonymous and inline functions in JavaScript?
- What is the difference between closure and nested functions in JavaScript?
- What is difference between unescape() and escape() functions in JavaScript?
- What is the difference between default and rest parameters in JavaScript functions?
- Difference between regular functions and arrow functions in JavaScript
- What is the difference between jQuery.map() and jQuery.grep() Functions in jQuery?
- What is the difference between jQuery.map() and jQuery.each() Functions in jQuery?
- What is the difference between ajaxSend() and ajaxStart() functions in jQuery?
- What is the difference between ajaxStop() and ajaxComplete() functions in jQuery?
- What is the difference between ajaxSuccess() and ajaxComplete() functions in jQuery?
- What is the difference between virtual and abstract functions in C#?
- What is the difference between CONCAT() and CONCAT_WS() functions?
- What is difference between raw_input() and input() functions in Python?
- What is the difference between == and === in JavaScript?

Advertisements