SlideShare una empresa de Scribd logo
1 de 1
Descargar para leer sin conexión
Microsoft AJAX Library: Array Type Extensions
                                                                                                     Array.forEach (array, method, context)
Array.add (array, item)
                                                                                                     Performs a specified action on each element of an Array object. Skips elements in
Adds an element to the end of an Array object.
                                                                                                     the array that have a value of undefined.
var a = ['a','b','c','d'];
                                                                                                     var a = ['a', 'b', 'c', 'd'];
Array.add(a, 'e');
                                                                                                     a[5] = 'e';
// a = ['a','b','c','d','e']
                                                                                                     var result = '';
Array.addRange (array, items)                                                                        function appendToString(arrayElement, index, array) {
Copies all the elements of a specified Array object to the end of the array.                             // quot;thisquot; is the context parameter, i.e. '|'.
                                                                                                         result += arrayElement + this + index + ',';
var a = ['a', 'b', 'c', 'd', 'e'];
                                                                                                     }
var b = ['f', 'g','h'];
                                                                                                     Array.forEach(a, appendToString, '|');
Array.addRange(a, b);
                                                                                                     // result = a|0,b|1,c|2,d|3,e|4,
// a = ['a','b','c','d','e','f','g','h']

                                                                                                     Array.indexOf (array, item, start)
Array.clear (array)
                                                                                                     Searches for the specified element of an Array object and returns its index. If item
Removes all elements from an Array instance.
                                                                                                     is not found in the array, returns -1.
Array.clone (array)                                                                                  var a = ['red', 'blue', 'green', 'blue'];
Creates a shallow copy of an Array object.                                                           var myFirstIndex = Array.indexOf(a, quot;bluequot;);
                                                                                                     var mySecondIndex = Array.indexOf (a, quot;bluequot;, (myFirstIndex + 1));
                                                                                                     // myFirstIndex = 1, mySecondIndex = 3
Remarks
                                                                                                     Array.insert (array, index, item)
A shallow copy contains only the elements of the array, whether they are reference
                                                                                                     Inserts a single item into a specified index of an Array object.
types or value types. However, it does not contain the referenced objects. The
                                                                                                     var a = ['a', 'b', 'd', 'e'];
references in the new Array object point to the same objects as in the original
                                                                                                     Array.insert(a, 2, 'c');
Array object. In contrast, a deep copy of an Array object copies the elements and
                                                                                                     // a = ['a','b','c','d','e']
everything directly or indirectly referenced by the elements.
                                                                                                     Array.parse (value)
var a = ['a','b','c','d'];
var b = Array.clone(a);
                                                                                                     Creates an array from a string representation.
// b = ['a','b','c','d']
                                                                                                     var a = Array.parse (quot;['red', 'blue', 'green']quot;);
Array.contains (array, item)                                                                         // a[0] = 'red', a[1] = 'blue', a[2] = 'green'
Determines whether the specified object exists as an element in an Array object.
                                                                                                     Array.enqueue (array, item)
var a = ['red','green','blue','yellow'];
                                                                                                     Adds the specified object to the end of an Array object. See also Array.dequeue ().
var b = Array.contains(a, quot;redquot;);
// b = true
                                                                                                     Array.remove(array, item)
Array.dequeue (array)                                                                                Removes the first occurrence of the specified item from an Array object.
Removes the first element from the Array object and returns it.
                                                                                                     var a = ['a', 'b', 'c', 'd', 'e'];
var myArray = [],result = quot;quot;;                                                                        Array.remove(a, 'c');
Array.add(myArray, 'a');                                                                             // a = ['a','b','d','e']
Array.add(myArray, 'b');                                                                             Array.removeAt(a, 2);
Array.add(myArray, 'c');                                                                             // a = ['a','b','e']
Array.add(myArray, 'd');
result = Array.dequeue(myArray);                                                                     Array.removeAt(array, index)
// myArray = ['b','c', 'd'], result = 'a'
                                                                                                     Removes an element from an Array object at a specified index location.

  A function is static and is invoked without creating an instance of the object   Based on Microsoft AJAX Library 1.0 • Compiled by Milan Negovan • www.AspNetResources.com • Last update: 2007-01-24

Más contenido relacionado

La actualidad más candente

Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-stringsPrincess Sam
 
PHP Unit 4 arrays
PHP Unit 4 arraysPHP Unit 4 arrays
PHP Unit 4 arraysKumar
 
Arrays in python
Arrays in pythonArrays in python
Arrays in pythonLifna C.S
 
Arrays in python
Arrays in pythonArrays in python
Arrays in pythonmoazamali28
 
Variables, expressions, standard types
 Variables, expressions, standard types  Variables, expressions, standard types
Variables, expressions, standard types Rubizza
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 
Arrays In Python | Python Array Operations | Edureka
Arrays In Python | Python Array Operations | EdurekaArrays In Python | Python Array Operations | Edureka
Arrays In Python | Python Array Operations | EdurekaEdureka!
 
Google collections api an introduction
Google collections api   an introductionGoogle collections api   an introduction
Google collections api an introductiongosain20
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection frameworkankitgarg_er
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - JavaDrishti Bhalla
 
5 collection framework
5 collection framework5 collection framework
5 collection frameworkMinal Maniar
 

La actualidad más candente (20)

Lec 25 - arrays-strings
Lec 25 - arrays-stringsLec 25 - arrays-strings
Lec 25 - arrays-strings
 
PHP Unit 4 arrays
PHP Unit 4 arraysPHP Unit 4 arrays
PHP Unit 4 arrays
 
Array lecture
Array lectureArray lecture
Array lecture
 
Collection and framework
Collection and frameworkCollection and framework
Collection and framework
 
20 ch22 collections
20 ch22 collections20 ch22 collections
20 ch22 collections
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Collections in Java Notes
Collections in Java NotesCollections in Java Notes
Collections in Java Notes
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Array in Java
Array in JavaArray in Java
Array in Java
 
Variables, expressions, standard types
 Variables, expressions, standard types  Variables, expressions, standard types
Variables, expressions, standard types
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Arrays In Python | Python Array Operations | Edureka
Arrays In Python | Python Array Operations | EdurekaArrays In Python | Python Array Operations | Edureka
Arrays In Python | Python Array Operations | Edureka
 
Google collections api an introduction
Google collections api   an introductionGoogle collections api   an introduction
Google collections api an introduction
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
 
Java collections notes
Java collections notesJava collections notes
Java collections notes
 

Destacado

PròXim Orient
PròXim OrientPròXim Orient
PròXim Orientmireia777
 
Discapacidad auditiva
Discapacidad auditivaDiscapacidad auditiva
Discapacidad auditivacynthissvir
 
PròXim Orient
PròXim OrientPròXim Orient
PròXim Orientmireia777
 
Modificada pueblos barbaros
Modificada pueblos barbarosModificada pueblos barbaros
Modificada pueblos barbarosAndrea Rodriguez
 
Modificación de "diario de un perro"
Modificación de "diario de un perro"Modificación de "diario de un perro"
Modificación de "diario de un perro"patriciar
 

Destacado (7)

PròXim Orient
PròXim OrientPròXim Orient
PròXim Orient
 
PròXim Orient
PròXim OrientPròXim Orient
PròXim Orient
 
Discapacidad auditiva
Discapacidad auditivaDiscapacidad auditiva
Discapacidad auditiva
 
PròXim Orient
PròXim OrientPròXim Orient
PròXim Orient
 
Modificada pueblos barbaros
Modificada pueblos barbarosModificada pueblos barbaros
Modificada pueblos barbaros
 
Ms Ajax Dom Element Class
Ms Ajax Dom Element ClassMs Ajax Dom Element Class
Ms Ajax Dom Element Class
 
Modificación de "diario de un perro"
Modificación de "diario de un perro"Modificación de "diario de un perro"
Modificación de "diario de un perro"
 

Similar a Ms Ajax Array Extensions

JAVASCRIPT OBJECTS.pdf
JAVASCRIPT OBJECTS.pdfJAVASCRIPT OBJECTS.pdf
JAVASCRIPT OBJECTS.pdfcherop41618145
 
ARRAY OPERATIONS.pptx
ARRAY OPERATIONS.pptxARRAY OPERATIONS.pptx
ARRAY OPERATIONS.pptxDarellMuchoko
 
Chap 3php array part 3
Chap 3php array part 3Chap 3php array part 3
Chap 3php array part 3monikadeshmane
 
PHP Language Trivia
PHP Language TriviaPHP Language Trivia
PHP Language TriviaNikita Popov
 
javascript-Array.ppsx
javascript-Array.ppsxjavascript-Array.ppsx
javascript-Array.ppsxVedantSaraf9
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaEdureka!
 
Lecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvvZahouAmel1
 
List of all php array functions
List of all php array functionsList of all php array functions
List of all php array functionsChetan Patel
 
Data Types and Processing in ES6
Data Types and Processing in ES6Data Types and Processing in ES6
Data Types and Processing in ES6m0bz
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testingVincent Pradeilles
 

Similar a Ms Ajax Array Extensions (20)

Java script arrays
Java script arraysJava script arrays
Java script arrays
 
JAVASCRIPT OBJECTS.pdf
JAVASCRIPT OBJECTS.pdfJAVASCRIPT OBJECTS.pdf
JAVASCRIPT OBJECTS.pdf
 
Intoduction to php arrays
Intoduction to php arraysIntoduction to php arrays
Intoduction to php arrays
 
ARRAY OPERATIONS.pptx
ARRAY OPERATIONS.pptxARRAY OPERATIONS.pptx
ARRAY OPERATIONS.pptx
 
Chap 3php array part 3
Chap 3php array part 3Chap 3php array part 3
Chap 3php array part 3
 
Chapter 2 wbp.pptx
Chapter 2 wbp.pptxChapter 2 wbp.pptx
Chapter 2 wbp.pptx
 
PHP Language Trivia
PHP Language TriviaPHP Language Trivia
PHP Language Trivia
 
Array properties
Array propertiesArray properties
Array properties
 
Php array
Php arrayPhp array
Php array
 
javascript-Array.ppsx
javascript-Array.ppsxjavascript-Array.ppsx
javascript-Array.ppsx
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
 
Lodash js
Lodash jsLodash js
Lodash js
 
Lecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvvLecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
Lecture 5 array in PHP.pptxLecture 10 CSS part 2.pptxvvvvvvvvvvvvvv
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
List of all php array functions
List of all php array functionsList of all php array functions
List of all php array functions
 
Data Types and Processing in ES6
Data Types and Processing in ES6Data Types and Processing in ES6
Data Types and Processing in ES6
 
SlideSet_4_Arraysnew.pdf
SlideSet_4_Arraysnew.pdfSlideSet_4_Arraysnew.pdf
SlideSet_4_Arraysnew.pdf
 
Unit 2-Arrays.pptx
Unit 2-Arrays.pptxUnit 2-Arrays.pptx
Unit 2-Arrays.pptx
 
Arrays in php
Arrays in phpArrays in php
Arrays in php
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testing
 

Más de jason hu 金良胡 (20)

新员工培训
新员工培训新员工培训
新员工培训
 
Javascript 闭包
Javascript 闭包Javascript 闭包
Javascript 闭包
 
Windows Powershell En
Windows Powershell   EnWindows Powershell   En
Windows Powershell En
 
正则表达式
正则表达式正则表达式
正则表达式
 
Work In Japan
Work In JapanWork In Japan
Work In Japan
 
Linuxcommand
LinuxcommandLinuxcommand
Linuxcommand
 
Ubunturef
UbunturefUbunturef
Ubunturef
 
Asp.Net运行时
Asp.Net运行时Asp.Net运行时
Asp.Net运行时
 
Fwunixref
FwunixrefFwunixref
Fwunixref
 
X Query
X QueryX Query
X Query
 
Sql2005 Xml
Sql2005 XmlSql2005 Xml
Sql2005 Xml
 
Ms Ajax Dom Element Class
Ms Ajax Dom Element ClassMs Ajax Dom Element Class
Ms Ajax Dom Element Class
 
Ms Ajax Number And Error Extensions
Ms Ajax Number And Error ExtensionsMs Ajax Number And Error Extensions
Ms Ajax Number And Error Extensions
 
Ms Ajax Dom Event Class
Ms Ajax Dom Event ClassMs Ajax Dom Event Class
Ms Ajax Dom Event Class
 
Ms Ajax Date And Boolean Extensions
Ms Ajax Date And Boolean ExtensionsMs Ajax Date And Boolean Extensions
Ms Ajax Date And Boolean Extensions
 
Ms Ajax String And Object Extensions
Ms Ajax String And Object ExtensionsMs Ajax String And Object Extensions
Ms Ajax String And Object Extensions
 
Ext Js Events
Ext Js EventsExt Js Events
Ext Js Events
 
Ext Js Dom Navigation
Ext Js Dom NavigationExt Js Dom Navigation
Ext Js Dom Navigation
 
Ext Js Events
Ext Js EventsExt Js Events
Ext Js Events
 
Ext J S Observable
Ext J S ObservableExt J S Observable
Ext J S Observable
 

Último

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 

Último (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 

Ms Ajax Array Extensions

  • 1. Microsoft AJAX Library: Array Type Extensions Array.forEach (array, method, context) Array.add (array, item) Performs a specified action on each element of an Array object. Skips elements in Adds an element to the end of an Array object. the array that have a value of undefined. var a = ['a','b','c','d']; var a = ['a', 'b', 'c', 'd']; Array.add(a, 'e'); a[5] = 'e'; // a = ['a','b','c','d','e'] var result = ''; Array.addRange (array, items) function appendToString(arrayElement, index, array) { Copies all the elements of a specified Array object to the end of the array. // quot;thisquot; is the context parameter, i.e. '|'. result += arrayElement + this + index + ','; var a = ['a', 'b', 'c', 'd', 'e']; } var b = ['f', 'g','h']; Array.forEach(a, appendToString, '|'); Array.addRange(a, b); // result = a|0,b|1,c|2,d|3,e|4, // a = ['a','b','c','d','e','f','g','h'] Array.indexOf (array, item, start) Array.clear (array) Searches for the specified element of an Array object and returns its index. If item Removes all elements from an Array instance. is not found in the array, returns -1. Array.clone (array) var a = ['red', 'blue', 'green', 'blue']; Creates a shallow copy of an Array object. var myFirstIndex = Array.indexOf(a, quot;bluequot;); var mySecondIndex = Array.indexOf (a, quot;bluequot;, (myFirstIndex + 1)); // myFirstIndex = 1, mySecondIndex = 3 Remarks Array.insert (array, index, item) A shallow copy contains only the elements of the array, whether they are reference Inserts a single item into a specified index of an Array object. types or value types. However, it does not contain the referenced objects. The var a = ['a', 'b', 'd', 'e']; references in the new Array object point to the same objects as in the original Array.insert(a, 2, 'c'); Array object. In contrast, a deep copy of an Array object copies the elements and // a = ['a','b','c','d','e'] everything directly or indirectly referenced by the elements. Array.parse (value) var a = ['a','b','c','d']; var b = Array.clone(a); Creates an array from a string representation. // b = ['a','b','c','d'] var a = Array.parse (quot;['red', 'blue', 'green']quot;); Array.contains (array, item) // a[0] = 'red', a[1] = 'blue', a[2] = 'green' Determines whether the specified object exists as an element in an Array object. Array.enqueue (array, item) var a = ['red','green','blue','yellow']; Adds the specified object to the end of an Array object. See also Array.dequeue (). var b = Array.contains(a, quot;redquot;); // b = true Array.remove(array, item) Array.dequeue (array) Removes the first occurrence of the specified item from an Array object. Removes the first element from the Array object and returns it. var a = ['a', 'b', 'c', 'd', 'e']; var myArray = [],result = quot;quot;; Array.remove(a, 'c'); Array.add(myArray, 'a'); // a = ['a','b','d','e'] Array.add(myArray, 'b'); Array.removeAt(a, 2); Array.add(myArray, 'c'); // a = ['a','b','e'] Array.add(myArray, 'd'); result = Array.dequeue(myArray); Array.removeAt(array, index) // myArray = ['b','c', 'd'], result = 'a' Removes an element from an Array object at a specified index location. A function is static and is invoked without creating an instance of the object Based on Microsoft AJAX Library 1.0 • Compiled by Milan Negovan • www.AspNetResources.com • Last update: 2007-01-24