I want to get the text of a tag and span tag at the same time.

```
    <td class="desc_autoHeight">
                    <a rel="nofollow" href="#" target="_blank">Silicon Power</a>
                    <br><span class="FreeGift">48 Hours Only</span>
                </td>

<td class="desc_autoHeight">
                    <a rel="nofollow" href="#" target="_blank">Silicon Power</a>
                    48 Hours Only
                </td>

```

Result should be Silicon Power 48 Hours Only
['https://Stackoverflow.com/questions/56659834', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/9730468/']
I suggest you create an array to store all your `a` elements like so:

```
var arr = [10, 15, 20];

```

Which you can then loop over using a for loop. In the array the 0th index represents the `a1` and the n-1th index represents `a*n*`:

```js
var arr = [10, 15, 20];
for (var i = 0; i < arr.length; i++) {
  console.log(arr[i]);
}
```

Another approach would be to use an object, where `a1`, `a2`, ... `a*n*` are keys in your object:

```
var obj = {
  'a1': 10,
  'a2': 15,
  'a3': 20
}

```

You can then use bracket notation to access your keys and values:

```js
var obj = {
  'a1': 10,
  'a2': 15,
  'a3': 20
}

for (var i = 1; i <= 3; i++) {
  console.log(obj['a' + i]);
}
```

...or use a `for...in` loop to loop over your properties instead:

```js
var obj = {
  'a1': 10,
  'a2': 15,
  'a3': 20
}

for (var prop in obj) {
  console.log(obj[prop]);
}
```
```
var a = [10, 15, 20];
for (var i=0; i<a.length; i++){
    console.log("The value of a[i] is", a[i]);
}

```