Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Learning javascript through codecademy but need some help!
New Posts  All Forums:Forum Nav:

Learning javascript through codecademy but need some help! - Page 2

post #11 of 16
Quote:
Originally Posted by Abs.exe View Post

1. You havn't recommended him a language

Yea well I updated my post.
Quote:
Originally Posted by Abs.exe View Post

2. I said the easiest one for me right now is C#, if he wants to learn PEARL or RUBY, he's free to do so.

Well, for you! It looks like he's a newbie and asks if he did the right choice by choosing Javascript as a first language (so not for a particular purpose). What's a good programming language to get started up?

I'd say C if you want to say how things work or Google Go for a modern and fairly simple language that's not too high level. Javascript comes in handy for webapps/websites developments - it has a sheer level of abstractions.
Quote:
Originally Posted by Abs.exe View Post

3. What language doesn't have tradeoffs

Of course but I think you should explain these tradeoffs instead of plain saying "you should learn this language".
Quote:
Originally Posted by Abs.exe View Post

4. I find samsungs TV the easiest one to setup, if someone wants a TV that is easy to setup and ask me which one to get, why would I recommand him Sony when I have no clue how easy they are to setup (I hope you understand the point here)

Of course, but then again TVs are general purpose. People willing to get a TV just want something that works and has the most functionalities out there. On the other hand, languages are flavored, they serve different purposes.
Quote:
Originally Posted by Abs.exe View Post

5. I could have said, don't do JAVA, don't do PHP and don't try XYZ language, THAT IMO IS A BAD ADVICE.

Ahaha of course.
Quote:
Originally Posted by Abs.exe View Post

On a side note, Un petit bonjour d'outre-mer.

Well it would be bonsoir here. wink.gif
Ti-89 Titanium
(13 items)
 
 
CPUMotherboardRAMHard Drive
Motorola 68k @16 MHz Ti-89 HW4 256 KB 2.6 MB Flash ROM 
OSMonitorPowerCase
Ti-89 OS 3.10 LCD Dot-Matrix 160x100 4x 1.5V AAA Ti-89 HW4 Black 
CPUMotherboardGraphicsRAM
Intel Core™ i7 930 Gigabyte GA-X58A-UD3R 2.0 Gigabyte GTX 470 SOC G.Skill RX 2x4GB 1600C8 
Hard DriveHard DriveOptical DriveCooling
PNY Prevail Elite 120GB Hitachi 7K1000.C 1TB LG GH24LS50 Noctua NH-C12P SE14 
OSOSMonitorKeyboard
Windows 8 Pro x64 Lubuntu 13.10 x64 Samsung BX2250 Logitech Illuminated 
PowerCaseMouseAudio
Be Quiet! S.P. E⁷ 600W Fractal Design Core 3000 Logitech G300 AKG K240 Studio 
  hide details  
Reply
Ti-89 Titanium
(13 items)
 
 
CPUMotherboardRAMHard Drive
Motorola 68k @16 MHz Ti-89 HW4 256 KB 2.6 MB Flash ROM 
OSMonitorPowerCase
Ti-89 OS 3.10 LCD Dot-Matrix 160x100 4x 1.5V AAA Ti-89 HW4 Black 
CPUMotherboardGraphicsRAM
Intel Core™ i7 930 Gigabyte GA-X58A-UD3R 2.0 Gigabyte GTX 470 SOC G.Skill RX 2x4GB 1600C8 
Hard DriveHard DriveOptical DriveCooling
PNY Prevail Elite 120GB Hitachi 7K1000.C 1TB LG GH24LS50 Noctua NH-C12P SE14 
OSOSMonitorKeyboard
Windows 8 Pro x64 Lubuntu 13.10 x64 Samsung BX2250 Logitech Illuminated 
PowerCaseMouseAudio
Be Quiet! S.P. E⁷ 600W Fractal Design Core 3000 Logitech G300 AKG K240 Studio 
  hide details  
Reply
post #12 of 16
Quote:
Originally Posted by adridu59 View Post

Well, for you! It looks like he's a newbie and asks if he did the right choice by choosing Javascript as a first language (so not for a particular purpose). What's a good programming language to get started up?

As I said, I started with Java and I hate it, so starting from scratch today I would go for C#, I wish I could tell him use C but I don't know I don't know C.

I wish it was night here -.- Still 3 more hours before dawn.

Bonsoir wink.gif
post #13 of 16
Quote:
Originally Posted by Abs.exe View Post

As I said, I started with Java and I hate it, so starting from scratch today I would go for C#, I wish I could tell him use C but I don't know I don't know C.

Ah it's funny I learnt Java at school last year and our teacher gave us video tutorials made by a québécois. Well. Did my project with Arduino with is essentially C in the end tongue.gif.

The difference with C and Java/C# is that it doesn't have as much abstractions: doesn't need runtime, doesn't use GC, relies more on pointers to get the job done, etc. it's a bit more complex but you have more control over things in general. I tend to prefer this approach in general because, from my experience, the added abstractions of Java and consorts does not significantly ease the programmers job and you understand better how things work because you program at a lower-level—of course this is very subjective.
Quote:
Originally Posted by Abs.exe View Post

I wish it was night here -.-

Really? Bizarre!
Ti-89 Titanium
(13 items)
 
 
CPUMotherboardRAMHard Drive
Motorola 68k @16 MHz Ti-89 HW4 256 KB 2.6 MB Flash ROM 
OSMonitorPowerCase
Ti-89 OS 3.10 LCD Dot-Matrix 160x100 4x 1.5V AAA Ti-89 HW4 Black 
CPUMotherboardGraphicsRAM
Intel Core™ i7 930 Gigabyte GA-X58A-UD3R 2.0 Gigabyte GTX 470 SOC G.Skill RX 2x4GB 1600C8 
Hard DriveHard DriveOptical DriveCooling
PNY Prevail Elite 120GB Hitachi 7K1000.C 1TB LG GH24LS50 Noctua NH-C12P SE14 
OSOSMonitorKeyboard
Windows 8 Pro x64 Lubuntu 13.10 x64 Samsung BX2250 Logitech Illuminated 
PowerCaseMouseAudio
Be Quiet! S.P. E⁷ 600W Fractal Design Core 3000 Logitech G300 AKG K240 Studio 
  hide details  
Reply
Ti-89 Titanium
(13 items)
 
 
CPUMotherboardRAMHard Drive
Motorola 68k @16 MHz Ti-89 HW4 256 KB 2.6 MB Flash ROM 
OSMonitorPowerCase
Ti-89 OS 3.10 LCD Dot-Matrix 160x100 4x 1.5V AAA Ti-89 HW4 Black 
CPUMotherboardGraphicsRAM
Intel Core™ i7 930 Gigabyte GA-X58A-UD3R 2.0 Gigabyte GTX 470 SOC G.Skill RX 2x4GB 1600C8 
Hard DriveHard DriveOptical DriveCooling
PNY Prevail Elite 120GB Hitachi 7K1000.C 1TB LG GH24LS50 Noctua NH-C12P SE14 
OSOSMonitorKeyboard
Windows 8 Pro x64 Lubuntu 13.10 x64 Samsung BX2250 Logitech Illuminated 
PowerCaseMouseAudio
Be Quiet! S.P. E⁷ 600W Fractal Design Core 3000 Logitech G300 AKG K240 Studio 
  hide details  
Reply
post #14 of 16
Quote:
Originally Posted by adridu59 View Post

It's not disrecommended. Javascript is a useful language too and fairly easy to learn because dynamic typing etc etc. It's made to be rather easy-to-use.

I fail to see why you wrote text === "g" because basically you're trying to lookup if your String var containing "Hello" equals to "g" which is obviously not the case.

If you want to make use of your iterator you should use charAt, otherwise there should be substring functions. I don't know much about JS, just use it for misc DOM script but google what you want and it should come up easily.
Pushing someone to use a language because you use it yourself? Wow, not exactly a good advice imo. Plus C# has its tradeoffs.

A good language for starters imo would probably be plain C or Google Go for a modern and simplified approach.

Obviously C is a System programming language but it's a great choice when you want to learn what's going on in the machine. Else JS isn't a bad choice at all if you want a simple language that does all you want with a pretty good speed. JS ain't a compiled language through, you can run it standalone with node.js.

While his algorithm is off, using === is a MUST in Javascript due to bad type coercion that occurs when == is used.

My opinion is that Python and Scheme are the best beginner programming languages (with scheme being created at MIT specifically for their intro to programming course). C is a great language that everyone should learn, but memorizing the syntax and learning all the lower-level stuff is hard when you remember that most beginning programmers don't have the programming logic skills yet. While Abs.exe won't say it, I will quite clearly say DON'T learn PHP and don't learn Java (but especially don't learn PHP as your first language -- it will mess you up for good).

@OP, here's a working answer
Code:
text = "Blah blah blah blah blah blah Eric blah blah blah Eric blah blah Eric blah blah blah blah blah blah blah Eric";

var myName = "Eric";
var hits = [];
var i, j, nameLen;
var len = text.leng;

// Look for "E" in the text
for(i = 0; i < len; i += 1) {
    if (text[i] === "E") {
        nameLen = myName.length + i;
        // If we find it, add characters up to
        // the length of my name to the array
        for(j = i; j < nameLen; j += 1) {
            hits.push(text[j]);
        }
    }
}

if (hits.length === 0) {
console.log("Your name wasn't found!");
} else {
console.log(hits);
}

Edited by hajile - 11/29/13 at 1:03pm
post #15 of 16
Quote:
Originally Posted by hajile View Post

While his algorithm is off, using === is a MUST in Javascript due to bad type coercion that occurs when == is used.

My opinion is that Python and Scheme are the best beginner programming languages (with scheme being created at MIT specifically for their intro to programming course). C is a great language that everyone should learn, but memorizing the syntax and learning all the lower-level stuff is hard when you remember that most beginning programmers don't have the programming logic skills yet. While Abs.exe won't say it, I will quite clearly say DON'T learn PHP and don't learn Java (but especially don't learn PHP as your first language -- it will mess you up for good).

You know. I used to be a PHP expert. I really was. I knew all about the weirdness, every single intricacy, how the engine worked. EVERYTHING. And then one day I realized: This sucks. What the hell am I doing, screw this! So I saw a counselor ((not really)), and continued writing Windows applications.
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
post #16 of 16
Thread Starter 
Quote:
Originally Posted by hajile View Post

While his algorithm is off, using === is a MUST in Javascript due to bad type coercion that occurs when == is used.

My opinion is that Python and Scheme are the best beginner programming languages (with scheme being created at MIT specifically for their intro to programming course). C is a great language that everyone should learn, but memorizing the syntax and learning all the lower-level stuff is hard when you remember that most beginning programmers don't have the programming logic skills yet. While Abs.exe won't say it, I will quite clearly say DON'T learn PHP and don't learn Java (but especially don't learn PHP as your first language -- it will mess you up for good).

@OP, here's a working answer
Code:
text = "Blah blah blah blah blah blah Eric blah blah blah Eric blah blah Eric blah blah blah blah blah blah blah Eric";

var myName = "Eric";
var hits = [];
var i, j, nameLen;
var len = text.leng;

// Look for "E" in the text
for(i = 0; i < len; i += 1) {
    if (text[i] === "E") {
        nameLen = myName.length + i;
        // If we find it, add characters up to
        // the length of my name to the array
        for(j = i; j < nameLen; j += 1) {
            hits.push(text[j]);
        }
    }
}

if (hits.length === 0) {
console.log("Your name wasn't found!");
} else {
console.log(hits);
}

Yea I figured out the answer as soon as ABS posted lol I completely forgot to add my name to var text = " "
Code:
var text = "how are you giovanni";
var myName = "gio";
var hits = [];
for(var i = 0; i < text.length; i++){
if (text[i] === "g"){
    for(var j = i; j < (myName.length + i); j++){
hits.push(text[j]);
    
}
}
if(hits.length = 0) {
    console.log("Your name wasn't found!");
} else {
    console.log(hits);
}
}
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Learning javascript through codecademy but need some help!