Skip to main content
added 105 characters in body
Source Link

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.

Note: It will modify the original array, if you don't want to modify it you can use slice()

loc_array.slice(-1)[0] === 'index.html' 

Thanks @VinayPai for pointing this out.

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.

Note: It will modify the original array

Thanks @VinayPai for pointing this out.

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.

Note: It will modify the original array, if you don't want to modify it you can use slice()

loc_array.slice(-1)[0] === 'index.html' 

Thanks @VinayPai for pointing this out.

added 92 characters in body
Source Link

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.

Note: It will modify the original array

Thanks @VinayPai for pointing this out.

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.

Note: It will modify the original array

Thanks @VinayPai for pointing this out.

Source Link

Just putting another option here.

loc_array.splice(-1)[0] === 'index.html' 

I found the above approach more clean and short onliner. Please, free feel to try this one.