Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:33
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • May 10 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 25 17:12
    @mstellaluna banned @cmal
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:11
    thecodingaviator labeled #31179
  • Apr 01 18:09
    thecodingaviator commented #31179
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:09
    thecodingaviator labeled #31182
  • Apr 01 18:07
    thecodingaviator commented #31182
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator labeled #31190
  • Apr 01 18:07
    thecodingaviator commented #31190
  • Apr 01 18:05
    thecodingaviator commented #31157
  • Apr 01 18:04

    thecodingaviator on master

    remove A (#31157) (compare)

  • Apr 01 18:04
    thecodingaviator closed #31157
  • Apr 01 18:04
    thecodingaviator closed #33788
  • Apr 01 18:04
    thecodingaviator commented #33788
  • Apr 01 18:02
    thecodingaviator closed #31059
  • Apr 01 18:02
    thecodingaviator commented #31059
bitgrower
@bitgrower
@JToddFL -- then you are probably addressing it incorrectly ...
Jeremy
@JeremyAntonoff
@bitgrower didnt i do that with splitting it into an array?
@rspice i did that on paper i just dont know how to do it with the loop i need
bitgrower
@bitgrower

I'm just going by the symptom, @JToddFL -- not by looking at the code ...

...this is called "sanity checking" ... because our eyes can fool us!

so ... you take the evidence (it doesn't go beyond the word The) ... and say, hmmm what would cause that ?
Ryan Price
@rsprice
sounds like "The" is the longest word :)
Jeremy
@JeremyAntonoff
do i need another for loop nested?
Andrew Dutton
@andrew-dutton
@bitgrower well I just saw your solution to the Title Case problem and almost cried! lol... mine is so much longer and convoluted!!
Ryan Price
@rsprice
@JToddFL no way Jose
@AndreWaroux did you use a functional approach? :)
Jeremy
@JeremyAntonoff
so i would prob write out an if statement saying if (index[i] > (i dunno what to put here)
bitgrower
@bitgrower

LOL ... I think there are 3 solutions in there (2 are commented out) ... the first time I created a mini-state machine ...

...I steal profligately ...but I do try to understand what I've stolen, with the goal that I could replicate it if I were faced with the problem again ...

...so ... you too, can steal proligately and learn and have cool solutions ... :)
Ryan Price
@rsprice
@bitgrower can I see your solution??
bitgrower
@bitgrower
...just make sure you understand the code ... :)
Andrew Dutton
@andrew-dutton
@bitgrower I could see you first few solutions... but you final one is beautiful ;)
bitgrower
@bitgrower
@rsprice ... most people's code can be seen by going to freecodecamp.com/<camper's name>
Ryan Price
@rsprice
// iterate over each word in the string
  // if the current word is longer than the longest word
    // set the current word to be the longest word
@JToddFL ^
Something like this might work
Jeremy
@JeremyAntonoff
and i do that with index[i]
?
bitgrower
@bitgrower
and ... @AndreWaroux -- that last solution is one I can't take credit for ... i stole it ... :) ... i didn't know you could do that with replace ...
Andrew Dutton
@andrew-dutton
@bitgrower this term "mini state machine"... i haven't heard it before, but I am assuming it's what I've done... a hundred steps to get to the solutions...
Norman Dela Cruz
@dcnr
@JToddFL
yeah something like
LARGEST=0

for WORD in [#WORDS ARRAY]
do 
  if [#WORD > LARGEST]
  then
    #LARGEST=WORD
  fi
end
Ryan Price
@rsprice
Ruby?
What sorcery is this!?
bitgrower
@bitgrower
@JToddFL -- you're not that far from a solution ... I'm not sure why you weren't able to advance beyond "The" -- cuz I copied your code, output to console.log array[i] and it worked just fine for me ...
Eric
@Code-Eric
Hey guys anyone care to help me ive been stuck in this local variable thing in javascript. Im sure im just overly exhausted and missing something simple. prompt: Declare a local variable myVar inside myFunction

function myFunction() {
'use strict';
var loc =("myVar");

console.log(loc);
}

console.log(loc);

Jeremy
@JeremyAntonoff
is that ruby lol
thanks though dc
Ryan Price
@rsprice
not really
It's probably fortran or something, I just see do and end and immediately think Ruby
Richard Corbett
@reacorbett
@dcnr thanks
CamperBot
@camperbot
reacorbett sends brownie points to @dcnr :sparkles: :thumbsup: :sparkles:
:star: 714 | @dcnr | http://www.freecodecamp.com/dcnr
bitgrower
@bitgrower

@AndreWaroux -- a state machine is a type of ... uh ... hmmm how do I explain what a state machine is ...

...it does NOT mean something which takes a lot of steps ...

in specific ... I am keeping remembrance of what came in the past, what was my previous "state" -- specifically, was the previous character a blank or not ...

if it was blank, then I did one thing, otherwise I did something else ...

Jeremy
@JeremyAntonoff
@bitgrower i know im not to far off. just been stuck on this one line of code foever
Ryan Price
@rsprice
@JToddFL can you paste what you have right now?
bitgrower
@bitgrower
@AndreWaroux -- state machines are discussed in some famous compiler books ... and there's all kinds of interesting math around them ... so there are things called finite state automata ... and other weird things .. they are kind of fun ... I wish I knew more about them ... :)
@JToddFL -- are you comfortable with console.log now ?
here's another cool resource for you: http://pythontutor.com/javascript.html ... paste your code in there and you can see, visually, how it runs ... what variables are created, what values they take, etc ...
George Phalen
@gphalen
Can anyone help with #230 (Profile Lookup)?
Ryan Price
@rsprice
function longest (str) {
// iterate over each word in the string
  // if the current word is longer than the longest word
    // set the current word to be the longest word
};
We start out with this, which is a perfectly cromulent place to start. We now need to parse our logic and make sure it's sound. We know that iterate means loop, and you very cleverly took care of splitting the array into words, so I'll update our code.
This message was deleted
Jeremy
@JeremyAntonoff
sure
Eric
@Code-Eric

@Code-Eric
Hey guys anyone care to help me ive been stuck in this local variable thing in javascript. Im sure im just overly exhausted and missing something simple. prompt: Declare a local variable myVar inside myFunction
function myFunction() {
'use strict';

console.log(myVar);
}
myFunction();

// run and check the console
// myVar is not defined outside of myFunction
console.log(myVar);

Jeremy
@JeremyAntonoff
function findLongestWord(str) {
  var array = str.split(" ");
  var longestword = 0;
  var total = 0;

  for (i=0; i < array.length;i++) {
   total = [index[i] + total
            (if total > index[i])



  }
}

findLongestWord("The quick brown fox jumped over the lazy dog");
not sure why that bracket is there