CSS 1. Specificity What is CSS specificity? It’s the priority system CSS uses when multiple rules target the same element. Higher specificity wins. Order (low → high): Element selectors ( div , p , span ) → 0,0,1 Class / attribute / pseudo-class ( .btn , [type="text"] , :hover ) → 0,1,0 ID selectors ( #main ) → 1,0,0 Inline style ( style="color:red" ) → 1,0,0,0 (highest among normal) !important overrides normal specificity (but try to avoid it). Example: p { color: blue; } /* element */ .text { color: green; } /* class */ #intro { color: red; } /* id */ For <p id="intro" class="text">Hello</p> → color will be red . 2. How to show scroll: overflow-y: auto vs scroll overflow-y: auto Shows vertical scrollbar only when content is taller than container. Cleaner UI (no scrollbar if not needed). .container { max-height: 200px; overflow-y: auto; } overflow-y: scroll Scrollbar is...
1. What are features developed in your career 2. What are the custom components and have you created any. 3. Find the largest difference between numbers from a numeric array. const numberArray = [5, 12, 4, 8, 3, 9]; Without any in built method: Approach I: const largestDiff = (arr) => { let result; let maxItem; let minItem; for(let i = 0; i < numberArray.length; i++){ maxItem = numberArray[0] minItem = numberArray[0] for(let j = 0; j < numberArray.length; j++){ if(maxItem < numberArray[j]){ maxItem = numberArray[j] }else if(minItem < numberArray[j]){ minItem = minItem }else{ ...
1st round 1. Shallow vs deep copy 2. string reverse input 'js' output 'sj' 3. Arrow function uses 4. foreach vs map 5. virtual DOM 2nd round 1. Vuex vs pinina 2. inject provide 3. inject provide vs store management 4. center an element 5..classA, .classB what it will do 6. .classA .classB what it will do 7. let a =[10],b b=a a.push[3] console.log(a,b) 8. sum(a,b) , sum(a,b,c) how function will received those arguments 9. rest vs spread 10. object de structuring 11. compare object in js 12. remove duplicate in array 13. how will you delete an data in object 14. event bubbling 1. Shallow Copy vs Deep Copy Shallow Copy : Creates a new object but copies only the references to nested objects. Changes made to nested objects in the copied object affect the original. Used with methods like Object.assign() or spread operator {...obj } in JavaScript. let original = { a: 1, b: { c: 2 } }; let shallowCopy = {...original ...
Comments
Post a Comment