
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
What is the usage of fill() method in JavaScript?
The fill() method in JavaScript is used to fill elements with static value in an array. The following are the parameters for fill() −
- value− The value to be filled.
- begin− The start index to begin filling the array.
- end− The ending index to stop filling the array.
Example
You can try to run the following code to learn how to work with fill() method on JavaScript −
<!DOCTYPE html> <html> <body> <script> var num = ["One", "Two", "Three", "Four", "Five"]; document.write(num); document.write("<br>"+num.fill("Six",2,3)); </script> </body> </html>
- Related Articles
- What is the usage of join() method in JavaScript?
- What is the usage of every() method in JavaScript?
- What is the usage of copyWithin() method in JavaScript?
- What is the usage of some() method in JavaScript?
- What is the usage of Array.Every() method in JavaScript?
- Write the usage of split() method in javascript?
- What is the usage of in operator in JavaScript?
- What is the usage of onhashchange event in JavaScript?
- What is the usage of onpageshow event in JavaScript?
- What is the usage of onpagehide event in JavaScript?
- What is the usage of onscroll event in JavaScript?
- What is the usage of onresize event in JavaScript?
- What is the usage of onunload event in JavaScript?
- What is the usage of onblur event in JavaScript?
- What is the usage of onfocus event in JavaScript?

Advertisements