DEV Community

Cover image for Sibling selector & 4 other webdev tips you may want to know πŸš€
Mustapha Aouas
Mustapha Aouas

Posted on • Updated on

Sibling selector & 4 other webdev tips you may want to know πŸš€

1. CSS sibling selector

You can use the adjacent sibling combinator (+) to target a sibling that comes directly after the first target. Or you can use the general sibling combinator (~) to target any sibling that comes after the first target

CSS sibling selector

Β 

2. The capture attribute

You can open a device camera directly from the HTML using the β€œcapture” attribute.
Set it to β€œuser” if you want the selfie cam or to β€œenvironment” if you want the rear cam.

The capture attribute

Β 

3. Know how many fingers are touching the screen

Did you know that you can know how many fingers are touching the screen in javascript like this:

Know how many fingers are touching the screen

Β 


Hey there! I tweet daily about the things I learned in my 6+ years journey in web development, so if you like these tips consider following me on Twitter @theAngularGuy.


Β 

4. Triple equality special cases

In javascript triple equality (===) is usually enough for equality comparisons. But it has two special cases: NaN and -0 +0.
Hopefully Object.is() does not:

Triple equality special cases

Β 

5. Tuple in typescript

The difference between these two function is the type of the first one will be inferred as number[] while the type of the second will be a tuple of [number, number] (actually readonly [number, number])

Tuple in typescript

Β 
Β 

Let's connect

That's it for this week. I hope you liked it. If you did, please share it with your friends & colleagues and follow me on Twitter @theAngularGuy where I tweet about web development and computer science πŸš€

Cheers!

What to read next?

Top comments (2)

Collapse
 
acode123 profile image
acode123

Nice read, but way too much emoji.

Collapse
 
ryannerd profile image
Ryan Jentzsch

Yes. Needs much more cowbell.