1//HTML
2//<div id="elem" data-id="4hJ3s"></div>
3
4var elem = document.getElementById("elem");
5elem.getAttribute("data-id"); // "4hJ3s"
1var person = {
2 "first_name": "Bob",
3 "last_name": "Dylan"
4};
5person.hasOwnProperty('first_name'); //returns true
6person.hasOwnProperty('age'); //returns false
1//find first element with "someAttr" attribute
2document.querySelector('[someAttr]')
3
1<!-- example div in an html DOC -->
2<div id="div1">Hi Champ!</div>
3
4// in a console
5const div1 = document.getElementById('div1');
6//=> <div id="div1">Hi Champ!</div>
7
8const exampleAttr= div1.getAttribute('id');
9//=> "div1"
10
11const align = div1.getAttribute('align')
12//=> null
13
14