Not register but JAVA FINAL QUESTION

javascript

#1

Hey, I know this isn't really the spot for this question but I didn't see anywhere once I clicked on the java final. My question is...how exactly do I get myself configured with the 'adult' world to even give effort to the final. I d/l sublime text but so far it may as well just be a fancy notepad to me. Through talking to a friend the other night just in general about my new interest in coding he mentioned to maybe d/l Node as it was sort of 'fan-favorite' of java... honestly I still don't understand the jargon/tech aside from the taught java syntax...all executed within the 'local' (lol) domain of codecademy...so yea. Any help in syncing sublime text to node (which i've had no luck in accessing, aside from the icon allowing me to d/l it over and over) or just advice in general of how to code/test,run it outside this site...Thanks!!



#2

Are you talking about Java or JavaScript? Because you say Java, but you posted in the JavaScript section. I added the Java tags, but if you're talking about JS, let me know and you/I can change it.


#3

Sorry!! JavaScript. The final that's right after this cash register exercise. It recommends/walks you through d?l sublime text but says nothing else about 'going off into the big boy world' and I assume we are expected to run/test our code by means other than copy n pasting it back into codecademy...which honestly, the scared part of me is alright in doing. Forever. lol.jk.


#4

It shouldn't matter what text editor you use. The simplest one is the best for just starting out. We don't need bells and whistles and productivity tools until we ourselves become productive. That's when to look at workflow, not before.

Notepad++ is simple yet powerful enough for our purposes. And it's free. That and your favorite browser(s) and you have everything you need. The only Notepad I would shy away from the one that comes with Windows. That one has some provisos, particularly in how you save files intended for the web.

Familiarize yourself with the web console in FF or the JavaScript console in Chrome, or whatever console your browser offers in the Developer Tools section. Play around with the command line and try out direct commands. Pay close attention to the console error messages so you can relate them back to what you just entered. Soon you will be able to connect those messages to errors in your programs.

As for Node.js, that is something I would hold off on until you have a good feel for the lay of the land in the basic environment. It's not something to hurry out and get. Work with the minimum for a good length of time so you get lots of typing practice, form good syntax guidelines to follow for consistency in your work, and are comfortable with the concepts, not just the look and feel of the code.


#5

Ahh, I was able to find JavaScript console in the Chrome browser. Just ran a quick compare array exercise and got my first non-codcademy output. Baby steps!! lol. Thank you!! Kinda happy to hear the Node.js stuff is better off down the pike. :slight_smile:


#6

Alright...sorry, but...one final question. In the Javascript console, console area...how do you write code without it automatically executing (returning a 'undefined' generally) every-time you 'finish' something (if I declare a variable and hit 'return' after the :wink:. Sorry to be a pest. Im open to 'playing around' but this seems like a basic operation not intended to evade the user...or wannaBe-er. lol


#7

Write the code in your text editor and embed it in an HTML document. Then open that page and the from that page, the console. (Ctrl+Shift+J)

The script will run immediately and any error messages will display. F5 the page to run the script again.

Better still, save your script with a simple name, 'script.js` is common but you can only have one in a directory. When working with lots of files in a folder, I give the HTML page, the script and the stylesheet all the same name.

test.html
test.js
test.css

Load the script with the page,

<body>
  <div>

  </div>
  <script src="test.js"></script>
</body>

Now you can edit the JS and resave, then refresh the page. The console is updated instantly.

Also:

Write a function in your editor, save it. Then copy it and paste it in its entirety into the command line. Now the function is installed in memory and you can call it as much as you like. The function cannot be modified in memory, so to edit, just go back to your saved code and edit it, copy and paste in. It will overwrite the previous function.

You can also type in lines. Use Shift+Enter for a new line.

Since you are using Chrome, this will come in handy:

https://developers.google.com/web/tools/chrome-devtools/console/console-reference

This is normal console behavior.

> a = 5
< 5
> b = new Array(10)
< ► [undefined × 10]
> for (i=0; i<b.length; i++){b[i]=i}
< 9
> console.table)[b])

   ► Array[1]
< undefined

The .table method, just as .log has no return value so when it finishes executing the console echos a response, undefined. In fact any function you run that does not have a return, or has a return but no value, will result in the same response.


#8

The above gives a couple of examples for table(). This only works in Chrome as far as I know.


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.