-
Notifications
You must be signed in to change notification settings - Fork 15
JSArray.Fill
boxgaming edited this page Jul 25, 2026
·
5 revisions
Changes all elements within a range of indices in an array to a static value. It returns the modified array.
result = JSArray.Fill ( a, value, start%, end% )
- The a parameter contains the native Javascript array on which the operation will be performed.
- The value parameter specifies the number, string or object.
- The optional start% parameter specifies the index at which the fill operation will start. If not specified, the entire array will be filled with the provided value.
- The optional end% parameter specifies the index at which the fill operation will stop.
Import JSArray From "lib/lang/array.bas"
Dim numArray As Object
numArray = JSArray.Create(1, 2, 3, 4)
' Fill with 0 from position 2 until position 4
numArray = JSArray.Fill(numArray, 0, 2, 4)
Print JSArray.Join(numArray)
' Fill with 5 from position 1
numArray = JSArray.Fill(numArray, 5, 1)
Print JSArray.Join(numArray)
numArray = JSArray.Fill(numArray, 6)
Print JSArray.Join(numArray)1,2,0,0
1,5,5,5
6,6,6,6