Reply to discussion (solution)
What does /d / mean? Is it a regular expression?
var obj = document.getElementById('firstDiv').getElementsByTagName('div');var result = [];for(var i = 0; i < obj.length; i ++) result.push(obj[i].innerHTML.match(/\d+/)[0]);alert(result);
var obj = document.getElementById('firstDiv').getElementsByTagName('div');
var result = []; for(var i = 0; i < obj.length; i ) result.push(obj[i].innerHTML.match(/d /)[0]);
alert(res……
/d / What does it mean? Is it a regular expression?
Regular expression, only matches numbers
Quote from 1st floor t5500’s reply:
var obj = document. getElementById('firstDiv').getElementsByTagName('div');
var result = [];
for(var i = 0; i < obj.length; i ) result.push(obj[i] .innerHTML.matc……
1
1
JScript code
var obj = document.getElementById('firstDiv').getElementsByTagName('div');
var result = [];
for(var i = 0; i < obj.length; i ) result.push(obj[i].innerHTML.match(/d /)[0]);
alert(r...
Correct solution
What does it mean?
Define an array
var result = [];
What does it mean?