These are chat archives for FreeCodeCamp/Help

11th
Jan 2015
Dominic Desimini
@trisell
Jan 11 2015 00:03
sudo apt-get remove brackets
Dominic Jones
@towwiow
Jan 11 2015 00:08
@trisell should I download with or without the adobe extract?
downloaded without and got it going.
back to the football game
Dominic Jones
@towwiow
Jan 11 2015 01:39
@Maximization - I got the missing bracket
Dominic Jones
@towwiow
Jan 11 2015 01:51
@Maximization , @iheartkode & @terakilobyte - coding victory: http://dominicjones.info/javascript/cpu-guess.html
Nathan
@terakilobyte
Jan 11 2015 01:52
now have it print the maths out for the probability of it not guessing the number :)
Nathan
@terakilobyte
Jan 11 2015 02:01
odds are seriously in the computer’s favor :)
Nathan
@terakilobyte
Jan 11 2015 02:10
in fact, to bring it to just around a 50% chance of picking a number the compuer won’t guess, the range needs to be around 21-22!
perhaps my love of probability is why I don’t like gambling?
Dominic Jones
@towwiow
Jan 11 2015 02:15
I don't gamble either.
used to play texas hold 'em occassionally but haven't in a very long time and when I did play, it was just for fun.
@terakilobyte - I love how things can quickly escalate to the difficult end here. Lol. I'm not that far yet bruh v.v'
Nathan
@terakilobyte
Jan 11 2015 02:16
lol, it’s not that much more difficult
you know how many guesses are allowed
as well as the probability of a wrong guess (4/5)
Dominic Jones
@towwiow
Jan 11 2015 02:19
so how would I combine the two?
I was thinking of adding an alert when the user inputs a number outside of 0-5
Nathan
@terakilobyte
Jan 11 2015 02:21
so probably over time, given the same odds
is just P^times
so 4/5 = .8, .8^15
around 3.5%
Dominic Jones
@towwiow
Jan 11 2015 02:22
3.5% chance that the CPU guesses right?
Nathan
@terakilobyte
Jan 11 2015 02:22
to <marquee><blink>not not not!</blink></marquee> guess the number :)
no the computer has about a 96.5% chance to guess the number
for range 1-5
Dominic Jones
@towwiow
Jan 11 2015 02:23
Oh okay.
Can you do a line break in your alert?
Nathan
@terakilobyte
Jan 11 2015 02:23
you’d have to expand the range to like 1-22 to bring it down to a 50% chance
Dominic Jones
@towwiow
Jan 11 2015 02:23
got ya
Nathan
@terakilobyte
Jan 11 2015 02:23
I’d just add it as a snarky comment :P
Dominic Jones
@towwiow
Jan 11 2015 02:24
Lol, I see.
Nathan
@terakilobyte
Jan 11 2015 02:24
something like “Of course I guessed your number, it was x (I had a y% chance of guessing it)"
Dominic Jones
@towwiow
Jan 11 2015 02:26
hehe, understood.
Dominic Jones
@towwiow
Jan 11 2015 03:15
@terakilobyte - I made it a bit more difficult.
Suzanne Atkinson
@AdventureBear
Jan 11 2015 05:37
using regex in JS
I did the regex module and am trying to figure otu where they go in js
for coderbyte challenge #2 (replace characters with next letter in alphabet), I'm trying to "escape" the non alpha characters lie "3" or "!".
I have this...
if (str.charAt(i)==/^[a-zA-z]/) {
        newchar = str.charAt(i);
but it's not taking. I'm assuming my regex usage is not correct. it's supposed to say, if the character is NOT (a-z) or (A-Z) then use the current character. i is a position i the original string as it loops through the length.
I also tried this, but all it did was capitalize the vowels (later) and did nto replace any of hte characters
      if (str.charAt(i)!=/[a-zA-z]/) {
        newchar = str.charAt(i);
thanks for any thoughts. headed to bed. :(
if (str.charAt(i)!=str.test(/[a-zA-z]/)) {
        newchar = str.charAt(i);
try something like that
sorry with charAt as well
Suzanne Atkinson
@AdventureBear
Jan 11 2015 05:43
ok
Ben Clist
@BenClist
Jan 11 2015 05:43
I usually break strings into an array to loop through, seems a bit easier
Suzanne Atkinson
@AdventureBear
Jan 11 2015 05:45
yeah I'm not real comfortable workign with strings. Id did the array thing for the first challenge. I think I need to come back to this in the AM
after some sleep. Thanks for the ideas.
Ben Clist
@BenClist
Jan 11 2015 05:46
just for example, from my solution to something else, this uses RegEx when looping through an array
for(i = 0; i < arr.length; i++){
    if(/[a-z]/.test(arr[i])){
      arr[i] = arr[i].toUpperCase();
    } else if(/[A-Z]/.test(arr[i])){
      arr[i] = arr[i].toLowerCase();
    };
  };
Suzanne Atkinson
@AdventureBear
Jan 11 2015 05:46
ok, i can read that...let's see if I can implement something similar. Thanks again. Headed to bed for now.
Ben Clist
@BenClist
Jan 11 2015 05:47
no worries, night
Alex Olteanu
@alexandruolteanu
Jan 11 2015 10:35
What's up code campers?
James McShane
@jmcshane
Jan 11 2015 12:28
Hey, does anyone know how to get ace to be the default editor from the c9 command line?
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 12:40
sorry no
Serhii Borovskyi
@serhiicss
Jan 11 2015 13:46
any CSS gurus on?
Simon Foster
@funkysi1701
Jan 11 2015 13:47
@serhiicss whats your css question?
I need to align last box with first 3
keeping it empty
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 13:51
@serhiicss style the three boxes sperately
Give each design according to the way you want to see it
use padding in negatives to position them
Serhii Borovskyi
@serhiicss
Jan 11 2015 13:55
but why is the last box positioned differently?
because no content inside?
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 13:55
you styled all three together
so each takes up the space it needs
the third one didn't find that space in the upper section so it moved down
that's my guess of course
Serhii Borovskyi
@serhiicss
Jan 11 2015 13:56
you mean up?
the last box (box 4)
is positioned above
Simon Foster
@funkysi1701
Jan 11 2015 13:56
reduce the width so all 4 will fit next to each other
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 13:56
^^
since they have fixed widths, they need that width to fit
Maxim Orlov
@Maximization
Jan 11 2015 13:57
it's not a width issue
Serhii Borovskyi
@serhiicss
Jan 11 2015 13:58
@Maximization its inline-block issue
Maxim Orlov
@Maximization
Jan 11 2015 13:58
display: inline-block;
Serhii Borovskyi
@serhiicss
Jan 11 2015 13:58
yep
Maxim Orlov
@Maximization
Jan 11 2015 13:58
your last box has no content which cause this weird styling
Serhii Borovskyi
@serhiicss
Jan 11 2015 13:58
is there a fix? besides floating?
I don't want to float them
Simon Foster
@funkysi1701
Jan 11 2015 13:59
put   characters in 4th box?
& nbsp;
Serhii Borovskyi
@serhiicss
Jan 11 2015 14:00
hmmm
@funkysi let me see if I can do that
Serhii Borovskyi
@serhiicss
Jan 11 2015 14:06
Apparently vertical-align: top; fixes the issue. http://codepen.io/anon/pen/qERQEN
I hate css :)
Maxim Orlov
@Maximization
Jan 11 2015 14:09
ah, easy fix
to be honest fiddling with this kind of silly stuff and making sure to give support to all browser is what keeps me back from being a fully front end developer
there are bigger problems to solve out there
full stack with an emphasis on back end seems more comforting
Nathan
@terakilobyte
Jan 11 2015 14:12
^
Serhii Borovskyi
@serhiicss
Jan 11 2015 14:12
I know! Sometimes takes me hours to reach that aha moment.
Maxim Orlov
@Maximization
Jan 11 2015 14:12
time to install ubuntu, brb
Nathan
@terakilobyte
Jan 11 2015 14:12
I prefer cli over gui, my front end development will be limited to bootstrap I feel :P
Serhii Borovskyi
@serhiicss
Jan 11 2015 14:13
But I am having difficult time learning how to program. So I emphasize front end
Nathan
@terakilobyte
Jan 11 2015 14:14
front end is just a different kind of programming...
Serhii Borovskyi
@serhiicss
Jan 11 2015 14:14
Like jQuery, I understand everything they explain in tutorials. However, I don't know how to use it in exercises...
I think HTML/CSS is much easier than a programming language.
it is all visual
but that just me
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 14:46
"It looks we are calling the wrong method on our events. We want .remove(), instead of .destroy(). Fix it, and then save your changes."
This is the challenge i need help with
GrahamFischer
@GrahamFischer
Jan 11 2015 14:55
I've got a question. I'm not stuck though. I'm on section 3 of traversing the DOM on jquery. One of the functions they discussed was the event 'click'. My question is, how does jquery know what a click is? In other words, when I click my mouse button, how does that signal make it to jquery?
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 14:57
@GrahamFischer wish i knew that but sadly i don't
GrahamFischer
@GrahamFischer
Jan 11 2015 15:15
@AmmarAliShah that's alright
Justin Rogers
@yaskyj
Jan 11 2015 15:25
@GrahamFischer The browser is constantly monitoring events. Scrolling, clicking, right clicks, mouse position, etc. jQuery is just telling the browser "if this event (click) happens on this item (say a link) then do this (say change the css color)." Since the click event is just a shorthand for the "on" event, this documentation might give you more insight: http://api.jquery.com/on/
@AmmarAliShah What's the problem you're having with the challenge?
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 15:27
Can't understand what we have to do
Justin Rogers
@yaskyj
Jan 11 2015 15:28
Look under the sources tab in Devtools.
@AmmarAliShah And did you download the Chrome extension for their Devtool exercises?
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 15:52
@yaskyj yeah i did
Justin Rogers
@yaskyj
Jan 11 2015 15:54
So you've changed the call to destroy to a remove call, saved it, and then run the removeEvents function in the console and still not working?
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 15:58
wait wrong challenge
This one
Enable pause on exception.
GrahamFischer
@GrahamFischer
Jan 11 2015 16:03
thanks @yaskyj
Justin Rogers
@yaskyj
Jan 11 2015 16:03
@AmmarAliShah When field is defined it's using the wrong class.
Inspect the input box element and it will show you what class it is.
Ammar Ali Shah
@AmmarAliShah
Jan 11 2015 16:04
Yup it showed me that
What to do now?
Justin Rogers
@yaskyj
Jan 11 2015 16:05
Have you changed the jQuery selection for 'var field' to the correct class?
Should read like this:
Calendar.createEvent = function() {
  var field = $('.create input[type="text"]')[0];
  var name = field.value;
  if (name == "") {
    $(field).addClass('required');
  }
  else {
    Calendar.saveEvent({name: name, date: Calendar.displayedDate});
    Calendar.displayToday();
    $(field).removeClass('required').val('');
  }
}
;
I've changed the class from .createForm to .create
Ryan Malm
@Rybar
Jan 11 2015 16:55
need some help debugging something, anyone available to take a look?
James McShane
@jmcshane
Jan 11 2015 16:56
I can look at something, what's up
black dot should move with arrow keys, isn't working.
they keyboard input isn't working, I'm logging it and nothing
James McShane
@jmcshane
Jan 11 2015 17:02
ok, im looking thorugh the code, ill let you know if i find anything
Ryan Malm
@Rybar
Jan 11 2015 17:03
I've done this a dozen times, it's weird. should I add the event listener to something besides body I wonder?
James McShane
@jmcshane
Jan 11 2015 17:05
http://stackoverflow.com/questions/7167969/document-body-addeventlistener-is-not-working this looks like a fairly complex solution, but seems on track
Ryan Malm
@Rybar
Jan 11 2015 17:16
I'm thinking the issue is something simpler... this is the simplest possible example of key input for game interaction, I'm sure I'm just missing a syntax error somewhere, although lint didn't find anything wrong with my code
James McShane
@jmcshane
Jan 11 2015 17:16
yeah, im working in c9 trying to identify if there's a small issue
Travis L Barber
@tbarber350
Jan 11 2015 17:19
@Rybar event.keyKode shouldn't this be event.keycode
Ryan Malm
@Rybar
Jan 11 2015 17:22
lolol
Travis L Barber
@tbarber350
Jan 11 2015 17:22
sorry i mean keyCode
Ryan Malm
@Rybar
Jan 11 2015 17:24
Yes. and Yes. Thanks tbarber, I knew it was something stupid. Many eyes....
Travis L Barber
@tbarber350
Jan 11 2015 17:24
no problem
James McShane
@jmcshane
Jan 11 2015 17:25
nice to see it working
Travis L Barber
@tbarber350
Jan 11 2015 17:25
cool stuff
Ryan Malm
@Rybar
Jan 11 2015 17:26
I'm rolling through this series, just for fun: https://www.youtube.com/user/codingmath its suprising how much of html5 "game engines" are just simple vector math
Travis L Barber
@tbarber350
Jan 11 2015 17:27
that series looks really cool. I love that kind of stuff
Nathan
@terakilobyte
Jan 11 2015 17:58
wait, what? I just watched that video @Rybar . Nobody ever said we had to know maths
iheartkode @iheartkode runs away from math..
Ryan Malm
@Rybar
Jan 11 2015 18:17
I'm just doing these for fun, building a tiny arcade game lib
Nathan
@terakilobyte
Jan 11 2015 18:18
did you guys see the awesomeness of the internet arcade?
you’re welcome for an unproductive day :P
Kathy O'Driscoll
@odrisck
Jan 11 2015 18:19
yes I've seen it, if I bookmark it I'll never get any work done
Ryan Malm
@Rybar
Jan 11 2015 18:20
I was interested the minimum code base needed to create most arcade mechanics, i.e. asteroids, dual-stick shooters, etc. same maths can be used for interesting dynamic UX animation, so I'm not completely slacking off today LOL
Mark Howard
@iheartkode
Jan 11 2015 18:21
Its Sunday, you are allowed.
Ryan Malm
@Rybar
Jan 11 2015 18:21
I've seen the internet arcade, is pretty cool. Would be awesome if they added gamepad support, is available in most browsers now
Nathan
@terakilobyte
Jan 11 2015 18:21
yeah
playing oregon trial brings back some memories
Ryan Malm
@Rybar
Jan 11 2015 18:22
You have died of dysentery.
Mark Howard
@iheartkode
Jan 11 2015 18:22
I used to play that on Apple2
lol
Nathan
@terakilobyte
Jan 11 2015 18:22
jenny always dies of Dysentery somewhere in idaho
Mark Howard
@iheartkode
Jan 11 2015 18:22
forge the river and die
Ryan Malm
@Rybar
Jan 11 2015 18:22
I used to program Logo on the apple2; this canvas stuff I'm playing with now really reminds me of that
Nathan
@terakilobyte
Jan 11 2015 18:22
an axle will break in nebraska
Mark Howard
@iheartkode
Jan 11 2015 18:23
So whats up with profiles?
I don't want to promote it when it doesn't work.
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:30
i'm having trouble getting regex to work with string methods in JS for the coderbytel challege #2. I've read the w3 schools references and it's not really helping me. Does anyone have a good link to some examples of how regex can be used with various string operators or methods?
Branden Byers
@brandenbyers
Jan 11 2015 18:30
@AdventureBear http://www.regexr.com/
Nathan
@terakilobyte
Jan 11 2015 18:31
really nice interface
Branden Byers
@brandenbyers
Jan 11 2015 18:31
@terakilobyte but regexr has an even NICER interface!
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:31
those both look great...I also need examples of when & where regex can be used
when can I drop in an expression? I'm just not getting it.
Nathan
@terakilobyte
Jan 11 2015 18:32
@brndnb nowai
regex101 shows you exactly what each part of your regex is doing on the main screen :)
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:33
/[a-zA-Z]/g should work for me
but it's not working in this context
 if (str.charAt(i)!=str.test(/[a-zA-z]/)) {
    newchar = str.charAt(i);
Nathan
@terakilobyte
Jan 11 2015 18:34
try /$RegExp/.test(str)
and simplify your if statement
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:34
ok
it's my 3rd try, lol
Nathan
@terakilobyte
Jan 11 2015 18:35
something like w/e you expect str.charAt(i) to be
if(/$RegExp/.test(str.charAt(i))) {
Branden Byers
@brandenbyers
Jan 11 2015 18:38
@terakilobyte Regexr does the same thing with hover, but I see what you mean. I'll keep regex101 as my new backup.
Nathan
@terakilobyte
Jan 11 2015 18:39
mhmm, my bookmark sniffer I installed on your computer when we shared just notified me that you set it as your home page
it’s ok
:P
Branden Byers
@brandenbyers
Jan 11 2015 18:39
haha
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:48
function LetterChanges(str) { 
  var newstr = "";
  var newstr2 = "";
  var ascii = 0;
  var newchar = "";
  j = str.length; 
  for (i=0; i<j; i++)  
    {
    ascii = str.charCodeAt(i);
    //newchar = str.charAt(i);

      if(/[a-zA-z]/.test(str.charAt(i)))  {
         if (str.charAt(i)=="z" || str.charAt(i)=="Z") {
            newchar = "A"; 
         } else {
            newchar = String.fromCharCode(ascii+1);
         }

      } else {
         newchar = str.charAt(i);
      }

      newstr = newstr.concat(newchar);
    }

  str = newstr;
  // code goes here  
  return str; 

}
Ok, that works so far, except for the Capitalizations. Anything look too crazy? This is for coderbyte easy challenge #2.
i could do another test to see if it's the letter prior to the vowel, to add one to the ascii code and send to uppercase.
But at least the spaces, numbers and exclamations are getting through.
Nathan
@terakilobyte
Jan 11 2015 18:50
check out your regex test for one
also you can simplify it to /[a-z]/i
i is ignore case
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:50
so right now I only want it to manipulate if it's a character and not a space.
Ok good to knoww!
i realize there are a number of different ways to do the logic
Nathan
@terakilobyte
Jan 11 2015 18:53
I wouldn’t bother checking for vowelness in that loop
make work simple
rotate the letter
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:53
do it after the loop?
Nathan
@terakilobyte
Jan 11 2015 18:53
then, later, check if a vowel
again, a regex test will work great there ;)
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:53
htat's what I started doing...got this far, lol.
I am confused about how to insert a regex test. I've seen replace method used but it's not clear how test or replace documentation indicates I can use a regex. Or can I use it just like I'd use a string anywhere?
Nathan
@terakilobyte
Jan 11 2015 18:55
match, replace, search, test, and exec can all take regex
off the top fo my head
probably others too
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:55
and string manipultations...in this case I'm doing it by charactre, but I've seen examples (like replace) that use the whole string. I just need more exposure to these I guess.
OK
replace is a good place to start then for the vowelness
Nathan
@terakilobyte
Jan 11 2015 18:55
too heavy
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:56
hmph.
ok
Nathan
@terakilobyte
Jan 11 2015 18:56
and you’ll have to deal with a regexp object if I’m thinking about it correctly
nobody has time for that
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:56
var res = str.replace("My input String", /myregexvowels/);
??
Nathan
@terakilobyte
Jan 11 2015 18:56
nope
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:57
i just stole that form w3 schools example:
sigh.
var res = str.replace("Microsoft", "W3Schools");
Nathan
@terakilobyte
Jan 11 2015 18:57
var res = str.replace(“whatToReplace”, “replaceItWith”);
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:57
whattoreplace is the regex expression?
Nathan
@terakilobyte
Jan 11 2015 18:57
regex or a string
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:58
(is "regex expression" redundant?)
i'll try that...brb
Nathan
@terakilobyte
Jan 11 2015 18:58
if you don’t specify it as a regexp object, it will be turned into one
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:58
i'm ignoring that last comment for now, lol...
Nathan
@terakilobyte
Jan 11 2015 18:58
don’t be scared of implicitness
it abounds everywhere in the javascriptzes
Suzanne Atkinson
@AdventureBear
Jan 11 2015 18:59
now you're using big words!
Nathan
@terakilobyte
Jan 11 2015 18:59
though I feel it’s better to be explicit
specificity isn’t a bad thing until it is, ya know?
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:09
so what youre saying is...
I don't need to specifiy it as an object
and depending on how I use it
JS will turn it into one if needed?
Nathan
@terakilobyte
Jan 11 2015 19:10
it’s an object anyway, but yes js will convert its type
everything is an object in js
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:10
var res = str.replace(/aeiou/, str.toUpperCase()); <--something like this???
Nathan
@terakilobyte
Jan 11 2015 19:11
something like that
though I’d do that per letter
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:11
(syntax may not be correct)...just trying to wrap my head around it. If I don't know the letter being matched, I don't know what to replace it with...but I could use a method or function to replace it
Nathan
@terakilobyte
Jan 11 2015 19:11
doing it on the string, if it contains at least one vowel, will uppercase the entire thing
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:11
ohno, not good.
wow, this is easy challenge 2.
lol
Nathan
@terakilobyte
Jan 11 2015 19:12
we can pair on it if you want
I’ll make snarky comments
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:12
I'm at work right now at the call center job, I'm just making time pass between calls.
Nathan
@terakilobyte
Jan 11 2015 19:12
or maybe I’ll make smarmy comments
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:12
getting regex right is more imprtant than saving lives.
Nathan
@terakilobyte
Jan 11 2015 19:12
hmm
someone’s life could depend on regex!
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:13
absolutely true!!
that's why I gotta get it right. :)
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:13
maybe pair later. I have a lot of work I've been procrastinating by spending time playing with FCC stuff instead. It's a great procrastination tool
TRUTH
i'll just show that to my boss who already called t hrough once today.
"Since you're in the office today could you do this...".
You know a regex would have sufficed.
i need to let my brain rest
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:20
fascinating
input string: "abcde"
code:
var newstr2 = newstr.replace(/[aeiou]/, newstr.toUpperCase());
output string:
bcdBCDEFf
Nathan
@terakilobyte
Jan 11 2015 19:21
hmm
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:21
it replaced the lower case vowel with the whole string uppercased.
Nathan
@terakilobyte
Jan 11 2015 19:21
as if it’s inserting a whole new uppercased string where lowercase e belongs...
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:21
yep!
Nathan
@terakilobyte
Jan 11 2015 19:21
:P
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:21
I need to pull just the character.
lol
Nathan
@terakilobyte
Jan 11 2015 19:21
there be a bug in your code
it’s staring at you...
post all your code?
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:22
so I could lopo through like before, or I could locate the position of the character...more regex calls.
ok
function LetterChanges(str) { 
  var newstr = "";
  var newstr2 = "";
  var ascii = 0;
  var newchar = "";
  j = str.length; 
  for (i=0; i<j; i++)  
    {
    ascii = str.charCodeAt(i);
    //newchar = str.charAt(i);

      if(/[a-z]/i.test(str.charAt(i)))  {
         if (str.charAt(i)=="z" || str.charAt(i)=="Z") {
            newchar = "A"; 
         } else {
            newchar = String.fromCharCode(ascii+1);
         }

      } else {
         newchar = str.charAt(i);
      }

      newstr = newstr.concat(newchar);
    }


  var newstr2 = newstr.replace(/[aeiou]/, newstr.toUpperCase());

  str = newstr2;
  // code goes here  
  return str; 

}
Nathan
@terakilobyte
Jan 11 2015 19:23
what were your plans with the ascii variable?
ah I see
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:23
I use it to advance the char
unless it's "z" or "Z"
i don't know if I need all those varaibles
but I'd rather be explicit while sorting it out before getting all elegant with it
so my function in the replace command is causing the problem, beucase like you said it uppercases the whole string then insterts it to that character location
Nathan
@terakilobyte
Jan 11 2015 19:26
well
return newstr after the loop exits
ensure you are getting what you expect to newstr2
before the replace method
Suzanne Atkinson
@AdventureBear
Jan 11 2015 19:27
if I take the replace method out entirely, it returns the expected stuff minus the capitalization...is that what you mean?
except newstr, not newstr2
OH, and I found the solution for that cartoon you posted!
i'm gonna take a break for real, chat with you all later tonight, thanks for the ideas nathan.