Jump to content

few questions on javascript


Ninjakreborn

Recommended Posts

I am far from new at javascript, I have been working with it for 4 years on and off, but I have never stepped out of the lines of doing form validation, and small stuff like that, now I want to start creating full java script programs in my spare time, and either selling them, or renting them out, or keeping them for fun. I understand all the basic and intermediate concepts of javascript, and actually tried writing a few programs but didn't out of lack of inspiration. I had a few question about some things I wasn't sure of as pertaining to javascript.
1. Which is a better method Try Catch, or On Error.

2. Should I start utilizing try catch on all my scripts, if so how do I utilize it with if, else, and other like constructs.

3. What is the purpose of classes and what can they be used for, I have never used them, but I know the general format of setting them up and using, but don't see the point.

4. I want to create some javascript programs, where do I turn for inspiration, any ideas on possible programs, you get credit for the inspirational idea.

5. I have never had to use break so far, is it to get better timing during script execution. If so what do I need it for.

6. I also had one more question, say for instance I created a time and date function, and wanted to link them to something that states times and dates are based on your browser settings do I do it like this or another way.

All math functions
all date functions
var mydate = date functions
mytime = time functions you get the hint just showing you
document.write('<a href="mydate.htm">mydate</a>');
document.write('<a href="mytime.htm">mytime</a>');
The mydate mytime.htm are the pages that tell that the browser settings is what controls the time and date, would this work for accomplishing this task

7.I did a full math function doing
today = new Date();
document.write(today);
and it brough up the full time and date, and everything, but most tutorials use all the getTime, getFullYear, and getDate, why don't they just do what I showed above, is there other way better for some reason.
Link to comment
Share on other sites

i'm just curious, you said you've been working with js for 4 years and you don't know the answers to these questions?? i've been working with js for all of a week now and i can answer a few of those questions already:

3. classes are for making objects. objects are convenient ways of... well i'm not going to sit here and explain what an object is and what it's good for. just look up the topic object oriented programming.

4. inspiration? umm.. everywhere? anytime you go to a website and you see some feature that you really like, maybe you could try to immulate it. anytime you go to a website and you see some feature that you could be way better, maybe you can try to make it better. maybe you're sitting on the toilet staring at the wall and some random thought pops in your head.

5. while i've never personally used break in js, if it's anything like any other language out there, it's used for breaking out of loops. most commonly it is used in switch statements.

6. i have no idea what you are even asking.

7. why don't you try reading a manual or two, or picking up a book, or even typing "javascript gettime" in google? All of them are similar in some ways, different in others.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.