Could you explain that construct?  I'm no JS expert, and I haven't
seen it before.

Thanks.

> If you want to do it in JavaScript, you don't need jQuery, regular
> expressions, or indexOf. window.location (or just location) has several
> properties that give you different pieces of the URL. location.pathname is
> the one you want here. Note that it includes the leading slash. For example:
>
>     var img = {
>         '/services': 'one-image.png',
>         '/about-us': 'another-image.png'
>     }[location.pathname] || 'default-image.png';
>
> -Mike

Reply via email to