Translate

Saturday, March 29, 2014

Javascript Shorthand Method Usage

Hello, everybody;

This is not entirely new information, however, it was new to myself and many others. I recently discovered that in JavaScript, one can call methods on items from the DOM without first declaring them as a variable with the standard
'var varName = document.getElementById("someElement");'
.

For example assuming you had a paragraph tag with the id of 'someElement', the following JavaScript code:


someElement.innerHTML="I am some new text";


Accomplishes the same result as:


var someElement = document.getElementById("someElement");
someElement.innerHTML="I am some new text";




However, as with many things, just because it works doesn't mean it should be done. The small amount of information I was able to acquire about this strange occurrence stated that it is bad practice, and should be avoided, and relying on the browser to create your variables is never a good idea. I have verified that this works on Internet Explorer and Chrome, but have not checked Firefox/Safari/Opera etc.

So don't try this at home, folks. (Or do; just not in a live/professional setting)

Tuesday, March 11, 2014

My Plans for This Blog

Hello to everyone who may be reading this! What I plan to use this blog for is checking out new web technologies as giving my opinion on its strengths, weaknesses, and so on. In a way, it is as much of a sly way to motivate myself to investigate these budding technologies as it is to share my thoughts about them.

I have recently been overloaded with course work, primarily because I let myself get a bit behind in my textbook in one of my courses. Because of this, as well as other life changes, I have not actually had time to relax and read my library books ("Ajax Bible" by Steven Holzner, and "PHP & MySQL: The Missing Manual" by Brett McLaughlin), let alone come on here to post. On top of everything, I was recently hired as a web development intern, which is exciting, but also sure to be time consuming. All in all I am stoked to begin work there, though.

I will be attending Inter-Op 2014 during the first week of April, and I am sure I will have plenty to report about after having attended that.

Due to all of this, I hate to disappoint anyone, but this blog is still not quite officially 'started'. However, I will do my best to check out at least one technology the next time I have a chance!

Please bear with me and stay tuned! I hope to have plenty of interesting things to see here soon.