

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- 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 the difference between default and rest parameters in JavaScript functions?
- What is the difference between CONCAT() and CONCAT_WS() functions?
- Difference between regular functions and arrow functions in JavaScript
- 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 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 virtual and abstract functions in C#?
- What is the difference between == and === in JavaScript?
- What is the difference between Python functions datetime.now() and datetime.today()?
- What is the difference between MySQL INSTR() and FIND_IN_SET() functions?
Advertisements