This is the P2PU Archive. If you want the current site, go to www.p2pu.org!
You haven't posted any discussions yet.
Here is my blog post on task 1 and 2. Please let me know if I need to post this elsewhere.
http://ryan-wells.blogspot.com/2011/01/javascript-basics-1-video.html
RW
Since we are all here to learn I must ask. Why did you use the parseInt() function to get the value within the "quotemarks", instead of just asign the value to the variable, like t=2 without quotemarks and then put it together without parseInt()?
does it give some sort of benefit doing that way?
I did it that way 2, the reason that I went that rough is because its AS3 convention to wrap vars in single quotes;
AS3 Code example:
var helloTxt:string = 'Hello world!';
Is that not necessary in JavaScript?
we will probably learn about that in the course. But I think that the quotemarks is for text.
http://www.w3schools.com/js/js_variables.asp
they use the example:
var x=5;
var carname="Volvo";
I did mine real simple:
a=2;
b=2;
c=a+b;
alert(c)
and that worked well :)
then I did it your way and both work well :)
You can put it even simpler:
alert(2+2)
Quotemarks are for strings, so
alert("2"+"2")
same as:
alert('2'+'2')
will produce 22. Using ParseInt is good when you take values from user input. I think that's common practice to use ParseInt with mathematics in JavaScript to avoid string concatenate.
Or use alert(+'2' + (+'2')); :)
Great explanation, Jakub.
Oooo your good Jakub!
http://itsmartisans.com/javascript_class_intro/
I found 4 ways and I am sure there other variants also.
Will do the video tomorrow
http://www.plus2net.com/html_tutorial/tags-page.php these folks had a nifty page convert html code in a page.
That saved me a bit of brain-busting
oz
I used +"1" + +('1'), parseint(), and Number() - just because I could - they were aspects of the JavaScript Basics 1 video.
Of course the simplest method works just swell, but "knowing is half the battle"... and funner
Sure, it's wonderful to explore different ways of doing things while learning. That way we can make an informed choice about the best way to do something when writing production code.
I agree "knowing is half the battle"
I also think it's important to remember this old tidbit: There's more than one way to skin a cat. ;)
But always remember about Okham's Razor: The best solution is the simplest solution ;) Simpler program is faster.
Not quite: Occam's razor actually says the explanation that involves the fewest assumptions is usually better. That's usually, but definitely not always the simplest.
BTW hello everyone, here's my blog: http://stib.posterous.com/
and exercise: http://pureandapplied.com.au/p2pu/2plus2.html
I did it using the newly acquired insight into the way the + operator means two different things depending on the type of the variable: alert("2 + 2 = " + (2+2)) The middle "+" sign concatenates the first string with the result of the sum - turning it into a string, the last one adds the two numbers (that's why they're in parentheses so that the addition happens before the concatenation, otherwise it would have resulted in "2 + 2 = 22").
That's definitely true, you got me;) But I think that in the case of real application, when you have to think about security, user input etc., this definition will be even more accurate.
I didn't know we are supposed to put them here as well:
http://mayinc.madpage.com/SignUp.html
http://umustbe.wordpress.com/javascript-signup/
Just something I wanted to share.
As Blain said, there are multiple ways of solving a problem. This is something we come across very often in programming.
A certain approach has helped me:
1. While learning, try to do things in different ways, exploring even what may not be considered good solutions.
2. While writing production code, the simplest approach is usually the best approach. Code readability almost always trumps clever but obscure coding.
Along with learning Javascript I am hoping to discuss coding best practices also.
>>While writing production code, the simplest approach is usually the best approach. Code readability almost always trumps clever but obscure coding.
This is true. One thing that has stuck with me from my computer science courses is that most of the cost of software is incurred in the maintenance phase. So anything you can do as a programmer to make your code easier to understand (and therefore easier to maintain) is a good thing. This of course includes adding comments to your code where necessary.
Parag,
I'm glad to see you write that.
Roughly 15 years ago I learned C and C++. Once I finally started to wrap my brain around the concept of how software works I discovered a universe of conversation about how to optimize the code you write. Some of the best code examples I came across could have been described as "elegant". For me this took software programming from being a mere craft (albeit cool and highly technical) to being a kind of art.
Looking forward to this course,
n
I agree that progamming is kind of art. I've learned some JavaScript and PHP before and found that you can read books and watch videos and you will learn the language syntax, but with programming languages, like with human ones, you have many ways to do something. Great skill is to "tell" computer to do something really "cool", so you have to be creative. Knowledge is not everything.
I'm happy to see more people thinking like that. I hope we will have opportunity to share our thoughts.
Where are we supposed to post our blog notes and programming assignments? Here?
I posted it in the space just below where they have asked us to do the assignment...
I'm also confused on that one.
I have submitted task1 during the application procedure in the form supplied.
In jumped the gun and submitted the application before pasting my blog's address onto it. So here is the Url
http://swissrunner.blogspot.com/2011/01/javascript-101-blog-info.html
Roland
Hi,
Here is my blog post on task 1 and 2 from Prerequisites:
http://mtamasan-p2pu-jsbasics1.blogspot.com/2011/01/notes-about-javascri...
MT
Hi,
Here is my blog post for task 1 and task 2 :
http://javascript101-terupe.blogspot.com/
I sent all my notes in a post on here... and will look later if I can grab them to update my blog post with all my learnings from the Douglas Crockford talk. Great choice to start off with...
Here is my blog post: http://kaivong.com/2011/01/p2pu-webcraft-course-javascript-101/
Looking forward to learning lots in this journey and hearing from lots of you in the future :)
Pre-requisite tasks 1 and 2 have been completed and are online at http://p2pu.tumblr.com/
Garret, make sure to click "Apply" and put the link there
My blog and the assignment are linked from this web page: http://us
erpages.umbc.edu/~flinchba/JavascriptPractice.html. After I did the
assignment I tried some of the other ways that people did it too so that's
posted there too.
Thanks for accepting me to the course. Here is my blog with the pre-entrance assignments.
http://koldo-p2pu-javascript101.blogspot.com/
It is really good to see so many different methods used to the same job.
Hi All,
Just trying to start the pre-entrance assignments but can't get the video at http://www.diycomputerscience.com/courses/course/JAVASCRIPT/competency/185 to work. Is it just me and my lovely work connection?
Seems to be working for me mate. Try here: http://video.yahoo.com/watch/111593/1710507 , shouldn't be any different but worth the try.
I guess we're all linking our assignments here. Task 1 and 2 are on my javascript blog. http://jennysjavascript101.blogspot.com/
Thanks Jorge, your link is blocked at work. Time for some home work, thanks for the help!
adam
http://www.diycomputerscience.com/courses/course/JAVASCRIPT/competency/185
try that
Hello everyone!
Here are my impressions about the video aka task 1
iwannabejavascripter.wordpress.com
And my code for 2+2: http://jsfiddle.net/coper/GyHyX/
Hi David
that jsfiddle site seems quite interesting, I'll have a play with that....
Hi!
My second assignment: http://learningjs.wordpress.com/2011/01/14/first-step-in-learning-javasc...
Happy learning! :)
Ops I put the link at the other forum. I guess this is the right place.
Here is my sign up task post including the code for the task 2 too.
http://www.ivanteoh.com/blog/2011/01/javascript-101-sign-up/
"Write a simple Javascript program which will print the sum of 2+2 and display the result in an alert window in the browser."
I understood this as:
1) Print the sum of 2+2 in the browser AND
2) Display the result in an alert box
not just 2)....
Hi all, I finally set up a blog to document my course experiences. The homework for the application is up: http://tjlist.net/2011/01/hello-p2pu/
I look forward to interacting with everybody more.