These are chat archives for FreeCodeCamp/Help

17th
Jul 2018
Smootimus
@Smootimus
Jul 17 2018 01:04
Bling bling
zedza
@zedsa
Jul 17 2018 01:16

<!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.css">
    <link rel="stylesheet" href="styles.css">
</head>
<body>
  <div class="ui inverted menu attached">

    <a href="/login" class="item">Login</a>
    <a href="/register" class="item">Register</a>

  </div>


<h1>new site</h1>

  <p>Anon/Visitor</p>
  <p>https://twitter.com/handymayhem/status/1018892223323262977</p>
  <p> UNCLE HOTEP on Twitter: &#34;Some of you dark skin women are acting real light skin right now. Tighten up.&#34; </p>
  <img src="http://localhost:3000/base/shots/45404bf7f65a3ffd83ea9f0be86cd055.png">
  <a href="../base/htmls/45404bf7f65a3ffd83ea9f0be86cd055.html">html</a>
  <a href="/link/5b4cec78723db73504bb3ffd">more</a>
</body>
</html>
for some reason in my img and ahref tags i get a cannot GET error
eben though the file paths are correct
even**
oh sorry hold on i made those changes to test it this is the original
Gallop丶
@loves127
Jul 17 2018 01:19
invalid url
zedza
@zedsa
Jul 17 2018 01:19

<!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.3/semantic.min.css">
    <link rel="stylesheet" href="styles.css">
</head>
<body>
  <div class="ui inverted menu attached">

    <a href="/login" class="item">Login</a>
    <a href="/register" class="item">Register</a>

  </div>


<h1>new site</h1>

  <p>Anon/Visitor</p>
  <p>https://twitter.com/handymayhem/status/1018892223323262977</p>
  <p> UNCLE HOTEP on Twitter: &#34;Some of you dark skin women are acting real light skin right now. Tighten up.&#34; </p>
  <img src="base/shots/45404bf7f65a3ffd83ea9f0be86cd055.png">
  <a href="base/htmls/45404bf7f65a3ffd83ea9f0be86cd055.html">html</a>
  <a href="/link/5b4cec78723db73504bb3ffd">more</a>
</body>
</html>
@loves127 this is the html i was talking about, the one before was changes i made to test, but the file path here is the correct one
Kyle Holm
@thekholm80
Jul 17 2018 01:20
can you use pastebin or codepen?
Kyle Holm
@thekholm80
Jul 17 2018 01:21
thank you
zedza
@zedsa
Jul 17 2018 01:22
this error has been driving me crazy, i didnt expect for simple html to give me issues
Gallop丶
@loves127
Jul 17 2018 01:23
relative path
image.png
image.png
Levis
@agabyte
Jul 17 2018 02:02
Hi
chenxinjie
@chenxinjie
Jul 17 2018 02:49
Are you ok?
Karma Drukpa
@coderkarma
Jul 17 2018 03:22
@thekholm80 are you online?
Kyle Holm
@thekholm80
Jul 17 2018 03:24
@coderkarma yessir
Karma Drukpa
@coderkarma
Jul 17 2018 03:24
sir could you guide me on this
Kyle Holm
@thekholm80
Jul 17 2018 03:27
maybe
dunno what 'this' is
i don't know how to approach or use my strategies for this
Kyle Holm
@thekholm80
Jul 17 2018 03:30
hmm
talk me through how you think you should go about it
i really don't think i'm helping you by telling you how i'd do it
Karma Drukpa
@coderkarma
Jul 17 2018 03:31
true
I am not quite confident about this problem but my general approach would be looping through the array and do another loop
Kyle Holm
@thekholm80
Jul 17 2018 03:35
tell me what the first loop will do
Karma Drukpa
@coderkarma
Jul 17 2018 03:37
it will loop through each element
removeDuplicatesFromSorted([1, 1, 1, 2, 2, 3]); // 5
so outer loop will loop through each element of that array
but i do not have clear thought how should i approach it .
Kyle Holm
@thekholm80
Jul 17 2018 03:39
and use a for() loop?

my only concern for that is:

Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.

if you're looping over the original array and need to modify it in place, the length of the array will change as you're looping
Karma Drukpa
@coderkarma
Jul 17 2018 03:40
i have to google that 0(1) thing
Kyle Holm
@thekholm80
Jul 17 2018 03:49
i think my first attempt isn't valid because i'm using a new array inside reduce(). this one's kind of tricky. pretty sure i have it though
Claudio Restifo
@Marmiz
Jul 17 2018 03:50
@coderkarma means that it's a constant memory usage. It's more relevant to language where you allocate memory manually.
@thekholm80 perhaps forEach :)
Karma Drukpa
@coderkarma
Jul 17 2018 03:50
I will steal your brain from your home . give me your adresss lol
Kyle Holm
@thekholm80
Jul 17 2018 03:51
@Marmiz i used a while loop lol
i know they're bad form, but i think they're fun
Claudio Restifo
@Marmiz
Jul 17 2018 03:51
if test is made properly you should not be able to use reduce, map or filter, as well as slice :)
Kyle Holm
@thekholm80
Jul 17 2018 03:52
por que no reduce?
Claudio Restifo
@Marmiz
Jul 17 2018 03:52
@thekholm80 forEach 3rd arg is the array itself :)
@thekholm80 cos it returns a new array. So technically you are alloccating extra memory
Kyle Holm
@thekholm80
Jul 17 2018 03:52
reduce returns a single value
only an array if you initialize as an array
so like [1, 2, 3].reduce((a, b) => a + b); // 6
but [1, 2, 3].reduce((a, b) => a < 3 ? [...a, b] : a, []) // [1, 2]
Claudio Restifo
@Marmiz
Jul 17 2018 03:55

Note that the input array is passed in by reference, which means modification to the input array will be known to the caller as well.

I guess it's true in JS, I fear it should complain in other languages

since we are doing JS guess reduce is ok as well :)
Kyle Holm
@thekholm80
Jul 17 2018 03:56
i'll show you how i used reduce, i did modify the original array
Aakash-DD
@Aakash-DD
Jul 17 2018 04:55

i want to create an android Gif converting/making app.How to make this kind of app. The app should have functions as follows- From Gallery (for first 2 options)

1) Images to Gif
2) Video to Gif
3) Camera to Gif

I don't want to create a animated Gif, but want to create a Live people Gif app. I want to know to make this as i need to integrate this with my project. Any help will be appreciated. Thanks in advance

Anand Potukuchi
@anandpotukchi
Jul 17 2018 05:25
can you give an example
unable to understand what you want
Claudio Restifo
@Marmiz
Jul 17 2018 06:04
You probably want to use native events for that. This means writing in Kotlin, Java or Cpp.
Head over the Android developer for more info
Claudio Restifo
@Marmiz
Jul 17 2018 06:18

@thekholm80 look at this bad boy:

var $$String = require("stdlib/string");
var Caml_string = require("stdlib/caml_string");

function reverse(s) {
  var l = s.length;
  return $$String.init(l, (function (i) {
                return Caml_string.get(s, l - (i + 1 | 0) | 0);
              }));
}

console.log(reverse("hello"));

Converting RE code to JS :laughing:

John
@taloloy18
Jul 17 2018 07:31
Hi guys
https://codepen.io/taloloy18/pen/MBweNv Can you help me with my code. I want to put the image on the left and my quote to the right of it.
Yago Estévez
@yagoestevez
Jul 17 2018 07:34
Hi
You've set the grid only
John
@taloloy18
Jul 17 2018 07:34
What should I do sir ?
Yago Estévez
@yagoestevez
Jul 17 2018 07:34
You need to specify the columns
John
@taloloy18
Jul 17 2018 07:34
in the CSS?
Claudio Restifo
@Marmiz
Jul 17 2018 07:34
@taloloy18 or use Bootstap's column system, since you have the library integrated.
Up to you :)
John
@taloloy18
Jul 17 2018 07:35
I don't get it sir. :-(
VIGHNESH SINGH THAKUR
@Vighnesh1234
Jul 17 2018 07:37
Hi guys
I am new to CSS/HTML/JS
I was working on the portfolio project
John
@taloloy18
Jul 17 2018 07:37
What code should I need to add for my quote to move to the left side of the image
VIGHNESH SINGH THAKUR
@Vighnesh1234
Jul 17 2018 07:38
stuck at viewport=welcome section test .. it is failing :(
need help
John
@taloloy18
Jul 17 2018 07:38
@Marmiz sir pls help XD
Claudio Restifo
@Marmiz
Jul 17 2018 07:40

@taloloy18 you either use your own CSS as @yagoestevez suggested, by properly implementing a grid layout.

Or use Bootstrap Grid implementation, since you have it in page.

read the docs and see what you can come up to yourself :)
that's the best way to learn

John
@taloloy18
Jul 17 2018 07:42
let me review it sir. Thanks. XD
Yago Estévez
@yagoestevez
Jul 17 2018 07:52
Sorry. Either you use bootstrap or fix/complete your html and css code
grid-template-column doesn't exist
its plural: grid-template-columnS
You can do:
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 2rem;
por example
Also
Both the H5 and the IMG should be in the same grid element (div in this case)
<div class="grid-container">
  <h5>blablablah</h5>
  <img src="..." ... />
</div>
Yago Estévez
@yagoestevez
Jul 17 2018 07:57
The css property for h5 line-height is unfinished. Always key: value; pairs there.
John
@taloloy18
Jul 17 2018 07:59
error
Yago Estévez
@yagoestevez
Jul 17 2018 07:59
?
John
@taloloy18
Jul 17 2018 08:01
done! yes!! but I need to interchange the image and quote positionhehehe..
Thank you sir!!! @yagoestevez grid-gap: 2rem;
How to interchange the location of my image and quote sir?
Yago Estévez
@yagoestevez
Jul 17 2018 08:06
The easiest way would be changing the order in the html code
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:06
hi
Yago Estévez
@yagoestevez
Jul 17 2018 08:06
first the img, then the h5
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:06
what's wrong with it
class MyApp extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      inputValue: ''
    }
    this.handleChange = this.handleChange.bind(this);
  }
  handleChange(event) {
    this.setState({
      inputValue: event.target.value
    });
  }
  render() {
    return ( 
       <div>
        { /* change code below this line */ }
          <GetInput />
          <RenderInput inputValue={this.state.inputValue} />
        { /* change code above this line */ }
       </div>
    );
  }
};

class GetInput extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h3>Get Input:</h3>
        <input
          value={this.props.inputValue}
          onChange={this.props.handleChange}/>
      </div>
    );
  }
};

class RenderInput extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h3>Input Render:</h3>
        <p>{this.props.inputValue}</p>
      </div>
    );
  }
};
Yago Estévez
@yagoestevez
Jul 17 2018 08:07
Wow, man... That deserves a pastebin
John
@taloloy18
Jul 17 2018 08:09
@yagoestevez I only want to move the image and the qutation. How to stay the other objects as usual?
Claudio Restifo
@Marmiz
Jul 17 2018 08:09
@anandpotukchi you never pass handleChange to any child components
Yago Estévez
@yagoestevez
Jul 17 2018 08:09
Well, GetInput component won't ever get inputValue nor handleChange as a prop
@taloloy18 You mean you want to leave the HTML as it is right now?
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:10
what's the probbelm @Marmiz
Yago Estévez
@yagoestevez
Jul 17 2018 08:10
In that case, google for grid-template-areas
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:10
how do i get the value then
i snet it as props
Claudio Restifo
@Marmiz
Jul 17 2018 08:11
@anandpotukchi you have to pass them as props as @yagoestevez just told you :)
John
@taloloy18
Jul 17 2018 08:11
Nope I only want to move my image and quote earlier however the others also move?
like my li and blockqoute tags
Yago Estévez
@yagoestevez
Jul 17 2018 08:11
<GetInput inputValue={this.state.inputValue} handleChange={this.handleChange} />
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:15
@yagoestevez why would i add handle change in the get inout
Yago Estévez
@yagoestevez
Jul 17 2018 08:15
@taloloy18 It shouldn't. The order should be like this:
open grid container
open image div
image
caption
close image div
h5 text
close grid container
@anandpotukchi Because of this:
onChange={this.props.handleChange}/>
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:19
can i call function of one class in another
directly
or shiuld iuse props like other for other tasks
Yago Estévez
@yagoestevez
Jul 17 2018 08:20
You can by instancing that class
But I guess what you want to do here is passing the function via props
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:20
is that possibe
Yago Estévez
@yagoestevez
Jul 17 2018 08:21
You can call a static function from a class of instance the class and call the function from the instance object
John
@taloloy18
Jul 17 2018 08:23
@yagoestevez I already close my div after h5 but still it affects the rest
Yago Estévez
@yagoestevez
Jul 17 2018 08:25
@taloloy18 follow the structure I told you and pay close attention to where you open and where you close your tags
Anand Potukuchi
@anandpotukchi
Jul 17 2018 08:26
try the w3 html syntax check
John
@taloloy18
Jul 17 2018 08:26
ok sir. I see it. I didnt put div in my li tag. XD
May Kittens Devour Your Soul
@diomed
Jul 17 2018 08:47
if i set smth to
right: 20px shouldn't that property move my div 20px from right side
John
@taloloy18
Jul 17 2018 08:48
Hello how to adjust the gap between my image and quote since they have large gap
additional question. Why is it my li tag and blockquote tag underline with my image although the container is only for my quote and image tag?
May Kittens Devour Your Soul
@diomed
Jul 17 2018 08:54
@taloloy18 why do u have this : <div>
without class or id doesnt mean anything
John
@taloloy18
Jul 17 2018 08:57
@diomed When I remove the div before h3 my id="tribute-link" will move to other side
@diomed Can you check mine in regards with the question above?
May Kittens Devour Your Soul
@diomed
Jul 17 2018 09:02
@taloloy18 u could center image by saying
img 
{margin: 0 auto}
John
@taloloy18
Jul 17 2018 09:08
I just want to remain the image on the left however I want to move the gap of my quote and image.
I tried the code above but i didnt work
Yago Estévez
@yagoestevez
Jul 17 2018 09:57
@taloloy18 Are you going to use bootstrap grid or css grid?
you're using a bootstrap container in the html code and defining a grid container in the css
Also, follow the structure I told you so the elements line up where they should
Aakash-DD
@Aakash-DD
Jul 17 2018 09:58
@anandpotukchi i want to create a Gif creating android app which will do that 3 setup functions
John
@taloloy18
Jul 17 2018 10:26
@yagoestevez
@yagoestevez what did you mean by close grid container? I might understand you differently
Smootimus
@Smootimus
Jul 17 2018 11:04
Death before Smalltalk
Anand Potukuchi
@anandpotukchi
Jul 17 2018 11:14
please help
class MyComponent extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      message: ''
    };
    this.handleEnter = this.handleEnter.bind(this);
    this.handleKeyPress = this.handleKeyPress.bind(this);
  }
  // change code below this line
  componentDidMount() {
    this.setState ({
      document.addEventListener("keydown",this.handleKeyPress);
}); 

  }
  componentWillUnmount() {

  }
  // change code above this line
  handleEnter() {
    this.setState({
      message: this.state.message + 'You pressed the enter key! '
    });
  }
  handleKeyPress(event) {
    if (event.keyCode === 13) {
      this.handleEnter();
    }
  }
  render() {
    return (
      <div>
        <h1>{this.state.message}</h1>
      </div>
    );
  }
};
Anand Potukuchi
@anandpotukchi
Jul 17 2018 11:45
how do i complete this
Smootimus
@Smootimus
Jul 17 2018 11:46
I'm not hot with React yet, not really comfy =\
Anand Potukuchi
@anandpotukchi
Jul 17 2018 11:47
DAMN COMPLETE
I completed it
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Anand Potukuchi
@anandpotukchi
Jul 17 2018 12:44
don't know
haven't doen that
Idont follow FCC
just use the exercises to improve my skill
I'm sorry'
John
@taloloy18
Jul 17 2018 12:47
stock up with this grid! it take me 2 long already.
not yet
I'm already done in this Tribute page but I want to figure out how to use properly the grid because it is not working.
I was given instruction earlier but I dont get it. haizzzzz
Kyle Holm
@thekholm80
Jul 17 2018 12:52
@Marmiz i'm not quite sure what i'm looking at :point_up: July 17, 2018 12:18 AM
Nazar
@IsaakNazar
Jul 17 2018 13:06
@thekholm80 hey Kyle
Nazar
@IsaakNazar
Jul 17 2018 13:14
//there's an array of objects , each object has  "status"  key 
with values 'DECLINED', 'APPROVED' or 'NOT_REVIEWED'
// here outputs in this order -> Declined, Not reviewed, Approved
const myFunc = (resp) => resp.results.sort((a,b)=> a.status < b.status)

//if I change condition to 
 a.status > b.status
//then output is -> Declined, Approved, Not reviewed
I cant understand the logic, why Declined always goes first?
Anand Potukuchi
@anandpotukchi
Jul 17 2018 13:17
How do I complete this challenge
I've been trying to log everything onto the cinsole
nothing is working
class Dialog extends React.Component {
  constructor(props) {
    super(props);
  }
  componentWillUpdate() {
    console.log('Component is about to update...');
  }
  // change code below this line
    componentWillReceiveProps() {
      this.setState ({
        if(nextProps === this.props) {
            console.log(this.nextProps);
        }
      });
    }
  // change code above this line
  render() {
    return <h1>{this.props.message}</h1>
  }
};

class Controller extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      message: 'First Message'
    };
    this.changeMessage = this.changeMessage.bind(this);
  }
  changeMessage() {
    this.setState({
      message: 'Second Message'
    });
  }
  render() {
    return (
      <div>
        <button onClick={this.changeMessage}>Update</button>
        <Dialog message={this.state.message}/>
      </div>
    );
  }
};
Nazar
@IsaakNazar
Jul 17 2018 13:28
@anandpotukchi try () => {console.log()}
but im not sure
Anand Potukuchi
@anandpotukchi
Jul 17 2018 13:33
nope
not working
Yago Estévez
@yagoestevez
Jul 17 2018 13:59
What is nextProps?
Smootimus
@Smootimus
Jul 17 2018 14:01
Something undefined
:P
Yago Estévez
@yagoestevez
Jul 17 2018 14:03
Indeed :smile:
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:08
Well the instructions asked to check them against eachother
Yago Estévez
@yagoestevez
Jul 17 2018 14:08
Hehe
My question was a clue
:smile:
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:09
oh
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:15
da hell]
im moving on
the on,y thing I hate about fcc is that it's too long
Smootimus
@Smootimus
Jul 17 2018 14:16
What you mean
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:16
too many exercises
Smootimus
@Smootimus
Jul 17 2018 14:17
Eh
I dunno
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:17
It's too long and boring
unike odinproject
which is cut to the point
Smootimus
@Smootimus
Jul 17 2018 14:18
Never used odin
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:18
anybody know what's wrong with my code?
Smootimus
@Smootimus
Jul 17 2018 14:18
But I worry more about the quality
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:19
quality is 3.5/5
the length has a negative effect on the camper
Yashwardhan Pauranik
@yashwp
Jul 17 2018 14:20
Anyone knows, a better alternative for ladda button for angular 6? Please suggest me something you knw :)
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:20
@Smootimus which challenge are you on
Kyle Holm
@thekholm80
Jul 17 2018 14:33
@IsaakNazar i don't think sort works the way you have it written there
a.status < b.status how does JS give a value to 'DECLINED', 'APPROVED' or 'NOT_REVIEWED'? the way you have it written, the sort function will break it into unicode(i think?) and sort that way
yeah
The default sort order is according to string Unicode code points
Yashwardhan Pauranik
@yashwp
Jul 17 2018 14:35
@anandpotukchi I want loaders explicitly for buttons... like ladda do
Yago Estévez
@yagoestevez
Jul 17 2018 14:52
@anandpotukchi I gave you a hint already
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:52
not getting
Yago Estévez
@yagoestevez
Jul 17 2018 14:55
You're using an undefined variable
What do you think nextProps is?
ctrembla
@ctrembla
Jul 17 2018 14:55
hey everyone. I'm looking to make a nn to play a game I created. But all I can find so far are nn that can read and remember stuff. yes memory can be good, but I need help finding the tutorials for machine learning game play
Anand Potukuchi
@anandpotukchi
Jul 17 2018 14:55
@yagoestevez I've skipped that challenge for nnow
later
Yago Estévez
@yagoestevez
Jul 17 2018 14:56
Aright
Kyle Holm
@thekholm80
Jul 17 2018 15:03
@ctrembla this guy has been doing mario and mario kart with tensorflow, it's pretty awesome
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:32
what's the point of computer playing super mario?
computers shouldnt have fun
Aditya
@ezioda004
Jul 17 2018 15:36
They should play Dark Souls instead, and thats how the AI uprising will begin.
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:36
@ezioda004 could u help me with animating smth in JS
Aditya
@ezioda004
Jul 17 2018 15:38
Does it involve some intermediate CSS?
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:39
@ezioda004 I could show you and tell u then u'll see pen
I would like for that last square of particles to repeat effect that it has on hover - infinitely
Kyle Holm
@thekholm80
Jul 17 2018 15:41
if (time < infinity) {
  keepDoingParticleThingy();
}
ezpz
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:41
yesPlz
Aditya
@ezioda004
Jul 17 2018 15:42
^ There you go, next question please.
Kyle Holm
@thekholm80
Jul 17 2018 15:43
i think if i wrote a bunch of tensorflow game bots, i'd start each of them their own twitch streams
maybe that's what they fear when they say AI is going to take everyone's jobs?
Aditya
@ezioda004
Jul 17 2018 15:46
Totally, make them yell at the game every once in a while.
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:48
I'm stuck midway through the react challenges
can anyone help
or willing to pair program
please DM
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:49
@anandpotukchi from 0 to hero
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:50
did you write is?
Karma Drukpa
@coderkarma
Jul 17 2018 15:50
@ezioda004 @thekholm80
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:50
@diomed
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:50
obviously not. I'm a vue guy
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:50
ohk
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:50
didn't write anything vue yet, tho
:-|
Karma Drukpa
@coderkarma
Jul 17 2018 15:50
function reverseVowels(string){
    let vowels = 'aeiouAEIOU';
    let newStr = '';
    let j = string.length -1;
    let vowelSwapped = [];
    for (let i = 0; i < string.length; i += 1){
        let char = string[i];

      if(vowels.indexOf(char) === -1){
          newStr += char;
          // checking from right to left
        } else if (vowels.includes(char)){
            while( !vowels.includes(string[j]) && j >= 0){
                j --;
                string[i] = string[j];
              }
              j--;
            }
        }
   return newStr;
}

//  reverseVowels("aeiou"); // "uoiea"
//  reverseVowels("Tomatoes"); // "Temotaos"
so when char is vowel, i am not able to swap those vowels
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:51
vowels, Bob, wovels
Jacob Pieczynski
@JacobPie
Jul 17 2018 15:51
Hey, sorry but I am pretty new to the chat. I remember though that a few months ago there used to be a main channel where people would talk and there would be general conversation. Does that still exist?
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:52
@coderkarma the logic is to ravsese in the revese and place it in the newStr
Kyle Holm
@thekholm80
Jul 17 2018 15:52
@JacobPie nope
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:52
@JacobPie yes, but not on gitter
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:52
is that what you're doing?
@coderkarma
Karma Drukpa
@coderkarma
Jul 17 2018 15:52
yes i need to reverse the vowel if the char is vowel
Jacob Pieczynski
@JacobPie
Jul 17 2018 15:52
@diomed Darn. I used to really like that lol
Karma Drukpa
@coderkarma
Jul 17 2018 15:52
i tried doing making an empty array and pushing
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:53
@JacobPie I'll send u private message
Karma Drukpa
@coderkarma
Jul 17 2018 15:53
but that just creating many reversed vowel
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:53
did you traverse from the end to the begin
Karma Drukpa
@coderkarma
Jul 17 2018 15:54
I tried with the while loop
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:55
i = 0; i < string.length; i += 1
did you write this
Karma Drukpa
@coderkarma
Jul 17 2018 15:55
no
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:56
the that's waht yiu need to change
Karma Drukpa
@coderkarma
Jul 17 2018 15:56
i Did but first loop
Aditya
@ezioda004
Jul 17 2018 15:57
@coderkarma What is this part suppose to do?
 else if (vowels.includes(char)){
            while( !vowels.includes(string[j]) && j >= 0){
                j --;
                string[i] = string[j];
              }
              j--;
            }
Karma Drukpa
@coderkarma
Jul 17 2018 15:58
I was trying to swapp the vowels
May Kittens Devour Your Soul
@diomed
Jul 17 2018 15:58
I gasp for vowels
Karma Drukpa
@coderkarma
Jul 17 2018 15:58
first check if the char is vowel or not which gave me boolean right
Anand Potukuchi
@anandpotukchi
Jul 17 2018 15:59
@diomed lol
more like a I live for vowels
Aditya
@ezioda004
Jul 17 2018 16:00
Its not swapping the vowels though.
Karma Drukpa
@coderkarma
Jul 17 2018 16:00
yes it is not
Aditya
@ezioda004
Jul 17 2018 16:01
Perhaps have a different loop to just grab the vowels instead (or just use regex)?
Kyle Holm
@thekholm80
Jul 17 2018 16:03
i did it with regex and match() but had some really weird behavior
still not sure what was going on
Aditya
@ezioda004
Jul 17 2018 16:03
"Tomatoes".match(/[aeiou]/gi) will return an array with the vowels in the string, then reverse this array and loop through the original and have it replace the vowels.
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:10
guys, guys
the vowel exercise ws in the basic algo
before regex
Kyle Holm
@thekholm80
Jul 17 2018 16:11
and ?
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:11
so should be done with loops
and not use regex
Kyle Holm
@thekholm80
Jul 17 2018 16:12
lesson order doesn't mean we have to write code a certain way
Karma Drukpa
@coderkarma
Jul 17 2018 16:12
hahahha
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:12
well the tests are written a certain way
Kyle Holm
@thekholm80
Jul 17 2018 16:13
declarative > imperative, regardless of how the lessons are ordered
Karma Drukpa
@coderkarma
Jul 17 2018 16:13
okay , i will try with regax
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:13
that's the problem with the new tests
I faced those problems
Karma Drukpa
@coderkarma
Jul 17 2018 16:14
thanks for showing other way of doing
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:15
@coderkarma regex is the simplest way
but not sure it'll pass the tests
what happened?
if it did, good
Karma Drukpa
@coderkarma
Jul 17 2018 16:15
I am not quite comfortable with that
Kyle Holm
@thekholm80
Jul 17 2018 16:15
i don't remember this being a fCC lesson
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:15
if not, well
Kyle Holm
@thekholm80
Jul 17 2018 16:15
and i don't see it in the map
Karma Drukpa
@coderkarma
Jul 17 2018 16:16
I did this sort of problem once without using regax
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:16
hasn't map been relabelled cha;lenges
@coderkarma in c?
Karma Drukpa
@coderkarma
Jul 17 2018 16:16
no...
Kyle Holm
@thekholm80
Jul 17 2018 16:16
okay, then i don't see it in the challenges. geez
Karma Drukpa
@coderkarma
Jul 17 2018 16:16
js
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:16
hm
Alexander R Bott
@Abott1222
Jul 17 2018 16:20
@thekholm80 wazzaaaaaaa
do cs50 web with python and javascript with me lol
Kyle Holm
@thekholm80
Jul 17 2018 16:23
@Abott1222 maybe i should. i tried something with flask yesterday that failed miserably - i could probably use a refresher
send me a link and i'll go sign up
@thekholm80 mind if I send you some questions once they get into the flask section?
Kyle Holm
@thekholm80
Jul 17 2018 16:28
sure
Nazar
@IsaakNazar
Jul 17 2018 16:31
@thekholm80 hey Kyle, are you planning to get a dev job?
Kyle Holm
@thekholm80
Jul 17 2018 16:32
oh, i dunno
maybe some day
Nazar
@IsaakNazar
Jul 17 2018 16:32
@thekholm80 something holding you?
Kyle Holm
@thekholm80
Jul 17 2018 16:32
what i'd really like is to teach, but i'm not sure how i could do that without a college degree

something holding you?

i have a decent job right now, haven't felt the need to try to look elsewhere

Karma Drukpa
@coderkarma
Jul 17 2018 16:33
you should Kyle
Nazar
@IsaakNazar
Jul 17 2018 16:33
nice, so programming kinda hobby?
Kyle Holm
@thekholm80
Jul 17 2018 16:33
yeah. it's like doing a crossword puzzle, or sudoku
i like the puzzles
Nazar
@IsaakNazar
Jul 17 2018 16:34
ah, sudoku so boring heh
Kyle Holm
@thekholm80
Jul 17 2018 16:34
haha
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:34
anything wrong with this:

  @for $i from  1 through 5 {
    .text-#{$i} {font-size: 10px * $i; }
  }
the challenge is to increase font-size
Yago Estévez
@yagoestevez
Jul 17 2018 16:35
@coderkarma what's that challenge? I don't remember having done that :S
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:35
by ten times
Alexander R Bott
@Abott1222
Jul 17 2018 16:35
@thekholm80 if you like puzzles you should check out martin gardner. http://www.puzzles.com/puzzleplayground/Authors/MartinGardner.htm
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:35
each iteration
Nazar
@IsaakNazar
Jul 17 2018 16:35
maybe you are afraid of switching your habits, I mean to change a job
Kyle Holm
@thekholm80
Jul 17 2018 16:36
@Abott1222 this looks cool, thanks
@IsaakNazar it's more than that. i've been with my company for a while so i've built up a lot of benefits that are hard to just walk away from
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:37
renders well on screen but not pasing the challenge
sass anyone
?
ok done
Nazar
@IsaakNazar
Jul 17 2018 16:38
@thekholm80 I appreciate :thumbsup:
Yago Estévez
@yagoestevez
Jul 17 2018 16:40
@anandpotukchi Its because of the order
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:41
what>'
?
Yago Estévez
@yagoestevez
Jul 17 2018 16:41
You can't do 10px by 1
You must do 1 by 10px
Anand Potukuchi
@anandpotukchi
Jul 17 2018 16:42
still nit working
Yago Estévez
@yagoestevez
Jul 17 2018 16:43
it should
Kyle Holm
@thekholm80
Jul 17 2018 16:43
@coderkarma i gave up on regex for your problem, well specifically test() and match() they seem to have weird side-effects
Yago Estévez
@yagoestevez
Jul 17 2018 16:43
What's the challenge asking?
@thekholm80 using one line regex to make it work?
Kyle Holm
@thekholm80
Jul 17 2018 16:44
i'm not sure what you mean
Yago Estévez
@yagoestevez
Jul 17 2018 16:44
I mean... Not using loops or anything else?
Kyle Holm
@thekholm80
Jul 17 2018 16:45
right. i guess i can post what i was doing since it doesn't work lol
the problem i was having is match() didn't necessarily return the vowels in the order they appeared
Yago Estévez
@yagoestevez
Jul 17 2018 16:46
Ahh aright
Kyle Holm
@thekholm80
Jul 17 2018 16:46
and sometimes test() would return the wrong value
Yago Estévez
@yagoestevez
Jul 17 2018 16:46
I just did it another way
Close enough thou
:P
Kyle Holm
@thekholm80
Jul 17 2018 16:46
i did it without regex and it worked great lol. screw regex
Yago Estévez
@yagoestevez
Jul 17 2018 16:47
I don't recall doing this in the challenges
Where is it?
Kyle Holm
@thekholm80
Jul 17 2018 16:47
i don't think it's a freeCodeCamp problem
Yago Estévez
@yagoestevez
Jul 17 2018 16:47
Ah! Ok
Kyle Holm
@thekholm80
Jul 17 2018 16:47
maybe codewars ?
Yago Estévez
@yagoestevez
Jul 17 2018 16:47
Phew hehe
K thanks
I did it now with regex and a map
Actually its very close to your solution hehe
Should I paste it?
Kyle Holm
@thekholm80
Jul 17 2018 16:49
not if it works, @coderkarma still hasn't solved it yet
give him a chance to get the answer
Karma Drukpa
@coderkarma
Jul 17 2018 16:49
Hahaha I headed to the gym .
Kyle Holm
@thekholm80
Jul 17 2018 16:49
lol
Karma Drukpa
@coderkarma
Jul 17 2018 16:50
I have been dealing that since yesterday with other questions
Lol
Yago Estévez
@yagoestevez
Jul 17 2018 16:52
Ah I thought it was solved
Sorry
Kyle Holm
@thekholm80
Jul 17 2018 16:52
no worries
@yagoestevez you can pm it to me
if you want
Yago Estévez
@yagoestevez
Jul 17 2018 16:56
Aright. Gimme a minute
Not at the laptop now
ctrembla
@ctrembla
Jul 17 2018 17:28
@thekholm80 I've seen that & ever since I been trying to create something like that
Kyle Holm
@thekholm80
Jul 17 2018 17:29
@ctrembla in the comments he's put a link to a pastebin of his code, have you looked through it?
ctrembla
@ctrembla
Jul 17 2018 17:30
oh he did?
Karma Drukpa
@coderkarma
Jul 17 2018 17:31
I have not looked at it
ctrembla
@ctrembla
Jul 17 2018 17:31
looking at it now
would be helpful if someone could explain it. I'm more of a watch & ask question learner then a read & understand
Kyle Holm
@thekholm80
Jul 17 2018 17:43
i'm not familiar with the language he's using. it's like javascript and python had some weird mutant baby
ctrembla
@ctrembla
Jul 17 2018 17:44
oh I been trying for a while to build one in java I even tried to convert a javascript nn to java but failed
Kyle Holm
@thekholm80
Jul 17 2018 17:45
almost all machine learning i've seen has been done in python
to be fair, though, i haven't really looked at a lot of machine learning code
ctrembla
@ctrembla
Jul 17 2018 17:46
yea if was smart I'd just switch there and use the nn library
Kyle Holm
@thekholm80
Jul 17 2018 17:47
there's a tensorflow.js library too, but i don't know how easy it would be to get it to interact with a game running in an emulator
ctrembla
@ctrembla
Jul 17 2018 17:48
atm I'm just adding the nn to my code telling it what buttons and hidden nodes and outputs
ctrembla
@ctrembla
Jul 17 2018 17:55
but sadly I'm getting stuck with the way I'm trying to do it
Smootimus
@Smootimus
Jul 17 2018 19:25
Python is great for it
Kyle Holm
@thekholm80
Jul 17 2018 19:31
Python is great for it everything
fixed that for ya
Smootimus
@Smootimus
Jul 17 2018 19:38
Yes, thanks
Much appreciated
Kyle Holm
@thekholm80
Jul 17 2018 19:39
:joy:
May Kittens Devour Your Soul
@diomed
Jul 17 2018 19:43
woah! Discord's down.
yayx
google is to be blamed for everything
Karma Drukpa
@coderkarma
Jul 17 2018 20:02
@thekholm80
if i do string.match[/[aeiou]/gi], it gives vowel in str right
Alexander R Bott
@Abott1222
Jul 17 2018 20:07
@diomed anything but discord!
Karma Drukpa
@coderkarma
Jul 17 2018 20:12
function reverseVowels(string){
    let vowels = 'aeiouAEIOU';
    let newStr = '';
    let vowelSwapped = [];

    for (let i = 0; i < string.length; i += 1){
        let char = string[i];

      if(vowels.indexOf(char) === -1){
          newStr += char;
        } else if (vowels.indexOf(char) > -1){
            let newWord= string.match(/[aieou]/gi);  // NOT SURE HERE HOW TO SWAPP?

         }
      }
   return newStr;
}
_
Yago Estévez
@yagoestevez
Jul 17 2018 20:13
@coderkarma nop, array
Karma Drukpa
@coderkarma
Jul 17 2018 20:13
array?
what do you mean?
Yago Estévez
@yagoestevez
Jul 17 2018 20:14
newWord becomes an array
Karma Drukpa
@coderkarma
Jul 17 2018 20:14
yes, i was thinking to reverse and join them
but still it doesn't swapp
Yago Estévez
@yagoestevez
Jul 17 2018 20:16
You might need to loop twice through the string
One for analyze the string, looking for vowels, and the second one to place them in reverse order
Right?
Karma Drukpa
@coderkarma
Jul 17 2018 20:18
i guess so, but wondering do i need loop through the original string
Kyle Holm
@thekholm80
Jul 17 2018 20:24
@coderkarma match() returns an array containing all the matches
Karma Drukpa
@coderkarma
Jul 17 2018 20:25
yes that what it did when i console .log newWord
wondering do i need a another loop as well @thekholm80 ?
Kyle Holm
@thekholm80
Jul 17 2018 20:25
so
let string = 'Hello':
let matches = string.match(/[aeiou]/gi);
console.log(matches) // ['e', 'o']
Karma Drukpa
@coderkarma
Jul 17 2018 20:26
yes
I get that.
Yago Estévez
@yagoestevez
Jul 17 2018 20:27
I don't see any other choice
Maybe it helps if you trying to express the algorithm on paper
Kyle Holm
@thekholm80
Jul 17 2018 20:27
there's a lot of ways you can do it, but i'd suggest gathering a list of all the vowels in string before looping over and beginning replacing
Karma Drukpa
@coderkarma
Jul 17 2018 20:32
can i store match vowels in one variable and loop over an orginal string
?
Kyle Holm
@thekholm80
Jul 17 2018 20:32
yep
Karma Drukpa
@coderkarma
Jul 17 2018 20:37
but how can i swap the vowels of that string? example plz
I store in a variable, loop through string but again i check if that char of looping str matches the vowels that i store in variable
Kyle Holm
@thekholm80
Jul 17 2018 20:39
and then?
if (current letter is a vowel) {
  // do what?
else {
  // do what?
}
Karma Drukpa
@coderkarma
Jul 17 2018 20:39
i have to swap
Kyle Holm
@thekholm80
Jul 17 2018 20:40
i guess the question is, how are you building your result?
Karma Drukpa
@coderkarma
Jul 17 2018 20:41
reverseVowels("Tomatoes"); // "Temotaos"
test case
if current char is a vowel then i want swap with next vowel
if not then will concate the char and empty str
Kyle Holm
@thekholm80
Jul 17 2018 20:42
right, but are you trying to mutate the string in place (strings are immutable, so you'll have to convert to a different data type) or build an entire new something for the result?
Karma Drukpa
@coderkarma
Jul 17 2018 20:43
oh split in array,reverse and join
Kyle Holm
@thekholm80
Jul 17 2018 20:43
i can get behind the split and join, but you're going to reverse the original string?
Karma Drukpa
@coderkarma
Jul 17 2018 20:44
oh wait. so if the char is vowel then i should reverse the original str
Kyle Holm
@thekholm80
Jul 17 2018 20:44
no
not that
to recap where we're at
var vowelsInString = string.match(your regex here); // you have an array of all the vowels in string
var splitString = string.split('');  // you've split the string into an array

for (let i = 0; i < splitString.length; i++) {  // you're looping over the array
  if (splitString[i] is a vowel) {
    // do this
  } else {
    // do this
  }
do you want to mutate the split string array, or build a new one?
Kyle Holm
@thekholm80
Jul 17 2018 20:50
hint: there's no wrong answer here, but you do need to decide because each approach is different
Karma Drukpa
@coderkarma
Jul 17 2018 20:52
so once we split the string we are getting an array right . so i guess we could reverse that array, can't we?
Kyle Holm
@thekholm80
Jul 17 2018 20:53
if you do that, you will have
string = "Hello";
splitString = string.split('').reverse(); // ['o', 'l', 'l', 'e', 'H']
seems like the hard way to go about it
remember, you only want to reverse the vowels, not all the letters
Karma Drukpa
@coderkarma
Jul 17 2018 20:54
ohh yes.. i only want to reverse vowels not chars
I don't want my string char to change except vowels
Kyle Holm
@thekholm80
Jul 17 2018 20:55
correct
Karma Drukpa
@coderkarma
Jul 17 2018 20:55
so create a new array
Kyle Holm
@thekholm80
Jul 17 2018 20:56
so
var vowelsInString = string.match(your regex here); // you have an array of all the vowels in string
var splitString = string.split('');  // you've split the string into an array
var result = [];  // an array to hold the result

for (let i = 0; i < splitString.length; i++) {  // you're looping over the array
  if (splitString[i] is a vowel) {
    // do this
  } else {
    // if not a vowel, just push the letter to results array
  }
}

return result.join('');
you're getting there
Karma Drukpa
@coderkarma
Jul 17 2018 21:02
so if splitString is a vowel we should reverse it else push char to new Arr
?
Kyle Holm
@thekholm80
Jul 17 2018 21:02
how do you plan to do that?
Karma Drukpa
@coderkarma
Jul 17 2018 21:05
vowels.includes(char ){ splitStr.reverse
?
Kyle Holm
@thekholm80
Jul 17 2018 21:05
every time you find a vowel, you'll reverse the split string array?
you have an array of all the vowels in the string. when you loop through the split string and find a vowel, why don't you just swap in a vowel from that other array?
Karma Drukpa
@coderkarma
Jul 17 2018 21:09
so by doing something like this str[i] = splitst[i]
?
Kyle Holm
@thekholm80
Jul 17 2018 21:10
you could do that, assuming you get the array of vowels in the correct order
and remember that the split string array is going to be longer than the vowels array, so you're not going to be able to use the same indexes
i would think the simplest way would be to remove the vowel from the vowel array after you use it, so that the vowel array only holds the vowels that haven't been swapped yet
using either shift() or pop(), depending on how you have the vowels array sorted
Kyle Holm
@thekholm80
Jul 17 2018 21:22
@diomed x
Karma Drukpa
@coderkarma
Jul 17 2018 21:22
I am confused.
Karma Drukpa
@coderkarma
Jul 17 2018 21:53
@thekholm80 so if i use pop or shift it will delete the vowel from the array but in our check if the char is vowel in the second loop, should delete them, we want to replace right
@thekholm80 sorry for making you confused and probably irritated
Kyle Holm
@thekholm80
Jul 17 2018 21:55
nah you're good
i'm just trying to think of another way to explain
things we know:
  1. the vowel array contains every vowel in string, in the order they appear in string
  2. every time we encounter a vowel in split string array, instead of pushing that vowel to our result array, we can take a vowel out of our vowel array and push that to result array instead
so the important thing is to take from the vowel array in the correct order
using pop() will take the last element in the array, but shift() will take the first element of the array
Karma Drukpa
@coderkarma
Jul 17 2018 21:59
yes understood that.
Kyle Holm
@thekholm80
Jul 17 2018 21:59
if using shift() the order of the elements in the vowels array needs to be reversed
but not if using pop()
Karma Drukpa
@coderkarma
Jul 17 2018 22:15
right.
Kyle Holm
@thekholm80
Jul 17 2018 22:16
i've given you all the pieces, i'm not sure which part you're struggling with
Karma Drukpa
@coderkarma
Jul 17 2018 22:16
ok, if that is a vowel, then i could delete the vowel
I am struggling with replacing the vowels
Kyle Holm
@thekholm80
Jul 17 2018 22:17
so your loop looks at a letter. if that letter is NOT a vowel, that letter goes into your results array. if it is a vowel, you grab the next element from the vowel array and put that in the results array instead
every loop, a letter gets added to the results array
Karma Drukpa
@coderkarma
Jul 17 2018 22:25
function reverseVowels(string){
    let vowels = 'aeiouAEIOU';
    let newStr = '';

    for (let i = 0; i < string.length; i += 1){
        let char = string[i];

      if(vowels.indexOf(char) === -1){
          newStr += char;
        } else if (vowels.indexOf(char) > -1){
            let newWord= string.match(/[aieou]/gi);
            let splitStr = string.split(''); ///
            let result = [];

             for (let i = 0; i < splitStr.length; i += 1){
                 let letter  = splitStr[i];

                if (vowels.indexOf(letter) > -1){
                     result.push(splitStr[i + 1]);
                } else {
                    result.push(letter);
                }
             }
         }
      }
     return result;
}
Kyle Holm
@thekholm80
Jul 17 2018 22:26
tell me what this does:
if (vowels.indexOf(letter) > -1){
  result.push(splitStr[i + 1]);
}
Karma Drukpa
@coderkarma
Jul 17 2018 22:27
i was trying to see letter which is splitstr arr ele is a vowel or not
Kyle Holm
@thekholm80
Jul 17 2018 22:28
okay, so that's the first line
what does the second line do?
Karma Drukpa
@coderkarma
Jul 17 2018 22:32
if it is a vowel then we are pushing splitStr index
I thought to add one just because it will be next element
Kyle Holm
@thekholm80
Jul 17 2018 22:34
right, so assume the following:
splitStr = ["H", "e", "l", "l", "o"];
i = 1;
// what is splitStr[i + 1] ?
your loop gets to that "e" and pushes splitStr[i + 1], what will that value be?
more importantly, what happens when i = 4 and you try to push splitStr[i + 1] when the highest index is 4?
Karma Drukpa
@coderkarma
Jul 17 2018 22:36
undefined
when i = 4 , then splitstr == undefined i guess
Kyle Holm
@thekholm80
Jul 17 2018 22:37
why are you guessing? have you tried running your code?
Karma Drukpa
@coderkarma
Jul 17 2018 22:38
i have not
Kyle Holm
@thekholm80
Jul 17 2018 22:39
are you sure you want to push undefinedto your results?
Karma Drukpa
@coderkarma
Jul 17 2018 22:40
no..
I Don't want to push undefined
Kyle Holm
@thekholm80
Jul 17 2018 22:41
Karma Drukpa
@coderkarma
Jul 17 2018 22:41
hahah how did you do it. tell me that tricks. that was cool
Kyle Holm
@thekholm80
Jul 17 2018 22:42
alt + click on a time stamp
Karma Drukpa
@coderkarma
Jul 17 2018 22:51
what is time stamp?
where is that key?
Kyle Holm
@thekholm80
Jul 17 2018 22:51
image.png
it's a stamp
that has the time
Karma Drukpa
@coderkarma
Jul 17 2018 22:52
i don't have that
Kyle Holm
@thekholm80
Jul 17 2018 22:52
sorry
Karma Drukpa
@coderkarma
Jul 17 2018 22:53
function reverseVowels(string){
    let vowels = 'aeiouAEIOU';
    let newStr = '';
    let vowelReplace = string.match(/[aeiouAEIOU]/gi);

    for (let i = 0; i < string.length; i += 1){
        let char = string[i];

      if(vowels.indexOf(char) === -1){
          newStr += char;

        } else if (vowels.includes(char)){
            newStr += vowelReplace.pop();
        }
      }
     return newStr;
}
got this way .
Kyle Holm
@thekholm80
Jul 17 2018 22:53
that looks promising
Karma Drukpa
@coderkarma
Jul 17 2018 22:53
but still i need to console.log to see how pop is working under the hoo
hood
Kyle Holm
@thekholm80
Jul 17 2018 22:54
not sure why you need the else if () statement though
Karma Drukpa
@coderkarma
Jul 17 2018 22:54
well, yes
i could do else
Kyle Holm
@thekholm80
Jul 17 2018 22:54
basically you've got
if (char is a vowel) {
  ...
} else if (char is a vowel) {
  ...
}
oh, wait i'm dumb
the first if statement is === -1
i missed that
Karma Drukpa
@coderkarma
Jul 17 2018 22:55
yes
it is not a vowel
first check
Kyle Holm
@thekholm80
Jul 17 2018 22:55
but really there's only 2 possible outcomes ... either it is a vowel or it isn't
so you should be able to just use if and else
Karma Drukpa
@coderkarma
Jul 17 2018 22:55
but i want to finish other one
the way we were going
what do i need to push in the result array
then
Kyle Holm
@thekholm80
Jul 17 2018 23:01
i thought you had it fine
and you're not using an array anymore, somehow you switched to building strings through concatenation
Karma Drukpa
@coderkarma
Jul 17 2018 23:02
no earlier one was not right
no no this is different method
function reverseVowels(string){
    let vowels = 'aeiouAEIOU';
    let newStr = '';

    for (let i = 0; i < string.length; i += 1){
        let char = string[i];

      if(vowels.indexOf(char) === -1){
          newStr += char;
        } else if (vowels.indexOf(char) > -1){
            let newWord= string.match(/[aieou]/gi);
            let splitStr = string.split(''); ///
            let result = [];

             for (let i = 0; i < splitStr.length; i += 1){
                 let letter  = splitStr[i];

                if (vowels.indexOf(letter) > -1){
                     result.push(splitStr[i + 1]);
                } else {
                    result.push(letter);
                }
             }
         }
      }
     return result;
}
This solution is still not working. i need to pop the splitstr arr
Kyle Holm
@thekholm80
Jul 17 2018 23:05
i'm confused ... you deleted something that looked like it would work, now you've got something completely different
Karma Drukpa
@coderkarma
Jul 17 2018 23:05
I got it work other way which was a way easier then this
but i want to solve this problem like the way we are doing it
Kyle Holm
@thekholm80
Jul 17 2018 23:06
the other way was the same as this way, you just used string concatenation to build the result instead of an array
now you have too many loops, lots of unneeded variables, it's a whole different animal
Karma Drukpa
@coderkarma
Jul 17 2018 23:08
this is why i was confused with two loops . I was doing this first
Kyle Holm
@thekholm80
Jul 17 2018 23:10
@Abott1222 found this at the end of project0 in that course
image.png
Smootimus
@Smootimus
Jul 17 2018 23:21
Lol
Elias Curran
@eliascurran
Jul 17 2018 23:25
image.png
can someone help me this code keeps crashing my browser and i don't know what to do, here is a screenshot i took
Kyle Holm
@thekholm80
Jul 17 2018 23:26
rendering a component inside itself is an infinite loop
Elias Curran
@eliascurran
Jul 17 2018 23:26
so what do i do
Kyle Holm
@thekholm80
Jul 17 2018 23:26
i'd suggest not rendering a component inside itself
class Foo extends react.Component {
 // ...
  render() {
    return (
      <Foo /> // don't do this
    )
  }
}
no foo inside foo
Smootimus
@Smootimus
Jul 17 2018 23:28
lol