เราสามารถใช้ forEach ในสำหรับแต่ละ

รหัสตัวอย่าง

1
0

จาวาสคริปต์ foreach ว

const array = ['Element_1', 'Element_2', 'Element_3']
array.forEach((currentElement, currentElementIndex, arrayOfCurrentElement) => {
  console.log(currentElement, currentElementIndex, arrayOfCurrentElement)
})
0
0

ใช้ forEach งานจาวาสคริปต์

 
		  let text = "";
function add()
		  { 
			  var node = Node.prototype;
			 nodeList =  NodeList.prototype;
			 const xxx = ["q", "w", "e", "r", "t"];
			 xxx.forEach(change);
			 console.log(xxx);
			 console.log(text);
             /*notice the array does not change but text does*/
	 }
	 function change(item, index) {
		 text += item+index;
	 }

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................