Things I Learned This Week :-
This week, I delved deeper into JavaScript, focusing on Arrays and the DOM (Document Object Model). Here’s a breakdown of what I covered:
JavaScript Arrays – Explored how arrays store multiple values, learned different methods like
push()
,pop()
,shift()
,unshift()
,splice()
,slice()
, and practiced looping through arrays efficiently. Want to know more? Head over to my keynotes.JavaScript DOM (Document Object Model) – Understood how the DOM represents the structure of a webpage, allowing JavaScript to interact with and manipulate elements dynamically. For more details, refer to my keynotes.
Selecting Elements in JavaScript – Learned various ways to select elements using
getElementById()
,getElementsByClassName()
,querySelector()
, andquerySelectorAll()
, enabling precise element targeting. Curious to explore them further? Refer to my keynotes.Manipulating Elements & Attributes – Practiced inserting new elements with
createElement()
andappendChild()
, modifying content withinnerHTML
, removing elements usingremove()
, and changing attributes dynamically withsetAttribute()
andgetAttribute()
. Also explored applying CSS styles via JavaScript for enhanced interactivity. Check out my keynotes for more details.
Steps That I Did :-
This week, I focused on JavaScript Arrays and DOM Manipulation. Here’s how I approached learning and implementing these concepts:
Explored JavaScript Arrays – Created different arrays and experimented with methods like
push()
,pop()
,shift()
,unshift()
,splice()
, andslice()
to modify array elements dynamically.Practiced DOM Manipulation – Accessed and modified webpage elements using JavaScript by selecting them with
getElementById()
,getElementsByClassName()
,querySelector()
, andquerySelectorAll()
.Added & Removed Elements Dynamically – Used
createElement()
,appendChild()
, andremove()
to insert and delete elements in the DOM, making webpages more interactive.Modified Attributes & Styles with JavaScript – Updated
src
,href
,class
, and other attributes dynamically usingsetAttribute()
andgetAttribute()
. Also styled elements by changingstyle
properties.
Challenges I Faced and How I Overcame Them :-
Understanding Complex Array Methods
Challenge: While working with methods likesplice()
,map()
, andfilter()
, I initially struggled to understand how they manipulate arrays differently.
How I Overcame It: I practiced each method separately with different examples and logged the outputs to the console to see their effects. I also referred to MDN documentation and created small exercises to reinforce my learning.Updating Attributes & Styles with JavaScript
Challenge: Changing attributes likesrc
andhref
dynamically didn’t work as expected sometimes, and updating CSS styles inline felt confusing at first.
How I Overcame It: I learned to usesetAttribute()
properly and practiced updating styles by modifyingelement.style.property
instead of relying only onclassList
. Building small experiments helped me get comfortable with these concepts.
Resources I Used :-
Documentation :- MDN Web Docs
Conclusion :-
This week was a deep dive into JavaScript Arrays and DOM Manipulation, and it truly expanded my understanding of how JavaScript interacts with web pages dynamically. From mastering complex array methods to efficiently selecting and modifying elements in the DOM, every challenge I faced helped solidify my learning.
The ability to insert, remove, and update elements dynamically using JavaScript has opened up a whole new world of possibilities for interactive web development. As I continue this journey, I’m excited to explore more advanced topics and build even more dynamic projects.
On to the next week of JavaScript adventures! 🚀💡