I read a blog post about it.

 
Pieratt: I’m not sure what i’m doing wrong here

Kosin: But i want to use a regex inside a switch statement

Kirksey: So, where window.location ends with ‘page=account’, i want to alert’asdf’

Derosie: Code: http://pastebin.com/ZYyss7CN

Shanahan: It always runs default tho

Kubu: You can’t do “case page.test’page=account$'”

Molinas: Sillyslux: what is the correct syntax? i chose test because my understanding is it returns a bool

Osterfeld: Test returns bool yes, i’m trying that myself

Brummel: Ultimately, i want 3 of these, for account, shipping, and cart

Lossman: I might have the regex wrong.

Anciso: If i run alertpage.test’page=account$’; i still get false when i’m expecting true

Prouty: Chars6, try this http://jsfiddle.net/983mchkd/

Rahmes: Http://jsfiddle.net/983mchkd/1/

Defusco: Under what condition would this be true ifstyle.styleSheet ?

Kegg: The latter will work with /?page=shipping&something=else too

Kleinke: Sillyslux: i don’t understand. is that first line var site = . supposed to be a string?

Dry: Regex.exec returns an array

Bigos: No, i mean the /page-.+/ part

Plaskett: Ist value is the full string, 2nd the match, therefore site1

Pile: No, line 1. should /page=.+ be wrapped in apostrophes?

Bennink: It can be in apo, but doesn’t have to

Timper: Do browsers fire anything when they put javascript into some sort of throttle/pause such as when a tab is not active?

Bouck: I have an app which is only partly recovering when it regains focus

Gargus: So I have td id=”anid”/td, and then var a = do***ent.getElementById”anid”; How can I figure out the x and y positions of the top-left corner of that element now?

Scheuermann: Is it as simple as a.style.x and a.style.y?

Inches: I’m trying to use this to position an element next to it.

Finkelman: Sillyslux: cool. now i’m not getting the default to fire when the url doens’t have extra paramaters, but i can get around that by wrapping the whole thing in an if statement

Nienhaus: I can’t set position: relative; on the table or the td because it causes various CSS glitches/bugs.

Zuchelkowski: Sillyslux: so this is what i’m looking at right now http://pastebin.com/sT4n51XA

Ankrom: Undrinkablesoup, unfotunately that is not a standard thing. You might be able to get something like that with getBoundingClientRect, and depending exactly how the apge goes you might need to mess with offsets

Boback: Http://jsfiddle.net/983mchkd/2/

Grzyb: What’s the purpose of the tilde operator?

Vonhagen: Sillyslux: yeah, whenever the contents of switch is null i get an error

Wojtanowski: Bitwise invert or something? It’s not really that useful.

Wojtanowski: Mainly because we don’t have integral types.

Diego: Sillyslux: i think screening for null ahead of time is what i’m going to need to do

Katzmann: I’ve seen that error too now

Stahlberg: Sillyslux: thanks for your help!

Timmreck: Sillyslux: i can figure out the rest from here

Descoteau: Havvy: But when would one use it?

Wojtanowski: Annoymouse: When programming in C on integral types.

Patuel: I think i’ve used it once. i really can’t remember when and why :

Wojtanowski: Possibly it’s used in asm.js.

Markie: Annoymouse, the simple answer would be never ;. The complicated answer is that you use it for logical operations involving binary. sometimes in javascript that’ll manifest as some cryptic performance hack

Rawling: I do remember it was fun

Ebrani: I read a blog post about it and the guy said it’s useful for str.indexOf