These are chat archives for FreeCodeCamp/Help

16th
Nov 2018
Karma Drukpa
@coderkarma
Nov 16 2018 00:02
But test is not passing, it even rectifying that
Manish Giri
@Manish-Giri
Nov 16 2018 00:06
remove the spaces
@coderkarma
Karma Drukpa
@coderkarma
Nov 16 2018 00:10
where?
class MyComponent extends React.Component{
  constructor(props){
    super(props);
  }

  render(){
    return(
      <h1> My First React Component! </h1>
    );
  }
}

ReactDOM.render(
  <MyComponent />,
   document.getElementById('challenge-node')
);
Jason Luboff
@JLuboff
Nov 16 2018 00:13
@coderkarma Reread the instructions, you're missing a part of it
Manish Giri
@Manish-Giri
Nov 16 2018 00:13
<h1> My First React Component! </h1>
@JLuboff did you get any snow
Jason Luboff
@JLuboff
Nov 16 2018 00:13
@Manish-Giri You're also missing part of it ;)
And nah..it doesn't snow here
Unless you count ash from the fires...but I haven't had any of that either luckily
Manish Giri
@Manish-Giri
Nov 16 2018 00:14
@JLuboff part of?
I just removed the spaces from his h1, and it passed
oh you're out west, makes sense
Jason Luboff
@JLuboff
Nov 16 2018 00:14
Really? You're missing the <div>
Manish Giri
@Manish-Giri
Nov 16 2018 00:16
Untitled.png
yeah..weird
Jason Luboff
@JLuboff
Nov 16 2018 00:19
Ya..that is odd
Manish Giri
@Manish-Giri
Nov 16 2018 00:20
i'm guessing their tests check only what the content is
Jason Luboff
@JLuboff
Nov 16 2018 00:20
Must be
Damn this query
Karma Drukpa
@coderkarma
Nov 16 2018 00:24
@JLuboff i don't think it is because of div
sorry it worked. question for React pro
Karma Drukpa
@coderkarma
Nov 16 2018 00:30
@Manish-Giri while doing ReactDOM. render how come that test is passing even doing "MyCoponent" and <MyComponent />
kinopotato
@kinopotato
Nov 16 2018 01:22
So I left my code because it was being too much and did a bunch of other things for a while, when I came back it still isn't working. wtf code?! Do I have to do everything?!
haha, I'm kinda hoping that AI won't take away my potential job, but I also kinda hope that it does. haha
Philip Durbin
@pdurbin
Nov 16 2018 02:05
@kinopotato yes, you have to do everything :smile:
kinopotato
@kinopotato
Nov 16 2018 02:07
last FCC JS challenge has got me stumped. They say that video games makes you violent, they should try coding. Now that makes you violent.
Philip Durbin
@pdurbin
Nov 16 2018 02:07
heh
kinopotato
@kinopotato
Nov 16 2018 02:45
Hello, how do I get this to true?
0 > 0.01 // return false
Claudio Restifo
@Marmiz
Nov 16 2018 02:54
!(0 > 0.01)
or even better
0 < 0.01
kinopotato
@kinopotato
Nov 16 2018 02:55
I don't know where I did wrong, my code is stopping :|
Aditya
@ezioda004
Nov 16 2018 02:55
:scream:
kinopotato
@kinopotato
Nov 16 2018 02:56
how do you know where your code is breaking?
Claudio Restifo
@Marmiz
Nov 16 2018 02:56
debugger :)
if you run it in a browser it will tell you the line where the error raised
kinopotato
@kinopotato
Nov 16 2018 02:56
you put that inside your loop right?
there's no syntax error though, would that still help?
Claudio Restifo
@Marmiz
Nov 16 2018 02:59
if you type debugger, the browser will stop the execution ad you can inspect and detect stuff around
but perhaps you just made an infinite loop. if you want feel free to paste the relevant code here, I's sure someone will be glad to help :smile:
kinopotato
@kinopotato
Nov 16 2018 03:05
it was another idiotic mistake, it's hard when you barely know what you're doing xD
Aditya
@ezioda004
Nov 16 2018 03:05
@coderkarma Ah, thats a bug. Could you report the issue on github if possible?
kinopotato
@kinopotato
Nov 16 2018 03:05
FCC's final JS challenge is quite . . . challenging.
Aditya
@ezioda004
Nov 16 2018 03:06
Back in my day you had to do no repeats please
kinopotato
@kinopotato
Nov 16 2018 03:06
this is weird though (I think)
if (totalChange - moneyTable[i] >= 0){
           totalChange = totalChange - moneyTable[i]
           totalChange = totalChange.toFixed(2);
           change[j][1] = change[j][1] - moneyTable[i]
           change[j][1] = change[j][1].toFixed(2);
           finalChange[j][1] = finalChange[j][1] + moneyTable[i] //when this is a subtraction, it works, addition, it returns TypeError: finalChange[j][1].toFixed is not a function
           finalChange[j][1] = finalChange[j][1].toFixed(2);
        }
@ezioda004 I will do that, maybe 5 years from now. hahaha
I can barely do JS as it is
Aditya
@ezioda004
Nov 16 2018 03:08
@kinopotato Whats finalChange[j][1]?
Is either of finalChange[j][1] or moneyTable[i] string?
kinopotato
@kinopotato
Nov 16 2018 03:09
I don't think so, because they work with subtraction
I get negative numbers though because, well, it's subtraction
how can the type change suddenly when it's addition
Aditya
@ezioda004
Nov 16 2018 03:10
Think again :P
"2" - "2" // 0
"2" + "2" // "22"
kinopotato
@kinopotato
Nov 16 2018 03:10
wth
Aditya
@ezioda004
Nov 16 2018 03:11
+ is an arithmetic operator as well as string concatenation operator.
So depending on the context it changes its function.
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:11
my current project now i can't have nothing show up when there is no javascript but my best skills are in react so is the solution serverside rendering? else there is nothign when javascript is off.. basically people with no js still need to be able to see the general layout and change pages etc
kinopotato
@kinopotato
Nov 16 2018 03:12
hmm it is a string, weird
Aditya
@ezioda004
Nov 16 2018 03:12
Welp, there you go. String constructor doesnt have .toFixed() only Number does.
Hence the Type Error
kinopotato
@kinopotato
Nov 16 2018 03:13
wdym?
what did I do with toFixed?? O.O
Aditya
@ezioda004
Nov 16 2018 03:13
//when this is a subtraction, it works, addition, it returns TypeError: finalChange[j][1].toFixed is not a function
Claudio Restifo
@Marmiz
Nov 16 2018 03:13
@darkphotonKN ain't there a noscript tag in html?
Aditya
@ezioda004
Nov 16 2018 03:14
"2".toFixed(2) //TypeError
(2).toFixed(2) // works
kinopotato
@kinopotato
Nov 16 2018 03:15
I removed it now, I hope it doesn't break my code elsewhere, ha haha hahahaha
huhuhuhu
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:15
@Marmiz yeah but how will that work in react when the entire thing is bundled in a js? I have to rewrite so much right?
whereas a standard no framework thing would at least have the base html
then i can add some noscript warnings and basically it would still show the original layout just without js functionality
but right now with react NOTHING shows up except one noscript message, i would need to add tons of stuff in the <noscript> like html layouts and style them with css in order to keep the layout of the original webpage
Claudio Restifo
@Marmiz
Nov 16 2018 03:17
@darkphotonKN yeah. you have to write some html and css yourself. But that's the point of it
Aditya
@ezioda004
Nov 16 2018 03:17
Why are you supporting JS naysayers?
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:18
cuz i got hired by a small start up now but they have no idea of this shite yet their task now is to do a government site
and it needs to have insane access, basically handicapped people and people without js as well etc
Aditya
@ezioda004
Nov 16 2018 03:18
Oh boy
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:18
everything is sorted except im not sure if i can use react with server side rendering
i looked at the handicap guidelines that part is actualy fine, i just need to allow them to tab through links and add a few hidden elements that they can tab too etc
the problem is the nojs part now
Aditya
@ezioda004
Nov 16 2018 03:19
Yes the accessibility isnt that hard to implement, just tab-index, aria-labels and you're good to go
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:19
i don't think rewriting the entire layout of the web page in <noscript> tags is realistic.. i would basically havbe the site in both react way and also inside no script tags
@ezioda004 yeah im surprised you know lol aren;'t u still studying
im just struggling with the nojs part. I had a look at server side rendering with nextjs
Aditya
@ezioda004
Nov 16 2018 03:20
We had to make projects with accessibility in mind :D
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:20
nice :DD
Aditya
@ezioda004
Nov 16 2018 03:21
There has to be a better way than rewriting the whole thing
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:21
yeah im looking at server side rendering now, i tried it with a small app of mine in the past and it renders without javascript, but i dont know much about serverside rendering so im worried for a larger site its gonna fail or i wont know how to host it
Aditya
@ezioda004
Nov 16 2018 03:23
Isnt SSR just a way to rendering on the server alongside client?
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:24
yep, so the react stuff is already loaded its shite on the server side, so even without js the site has its static html showing along with styling even without js
i tried it my small app didnt work without js (a react app) and when i tried using next js to allow it to server side render it worked. some functionality didnt work, the js logic inside the react, but thats fine, cuz at least the HTML / css generated from react loaded
but im afraid of using this SSR with or without nextjs in the long run, since its for work and the site wont be tiny
Aditya
@ezioda004
Nov 16 2018 03:25
Oh the generated HTML from server is sent to the client?
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:26
yeah it seems so, cuz all the html and the stylings are loaded correct without js on, with a react app
without it it loads a blank page with the create-react-app noscript "this site needs javascript to work"
Aditya
@ezioda004
Nov 16 2018 03:27
I think next.js can handle big sites
Because everything will be done on server
And node is already good with concurrent requests
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:28
hmm i hope so. i just dont know enough about SSR so was worried, like if it loads all the stuff server side what if with a medium to large site its ruins the load or servers lol i have no idea
Aditya
@ezioda004
Nov 16 2018 03:28
According to them Nextflix, Github uses next.js
So its definitely capable of handling tons of concurrency
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:29
yeah it uses node for the SSR. but our backend will be with C#. is there a way for this to work together? or they simply write api's which i use crud to get / read etc
@ezioda004 oh that's promising :D
Aditya
@ezioda004
Nov 16 2018 03:31
I think you'll need a JS runtime/envrionment to parse the React in server, so API seems like one option but idk enough C#
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:33
from what i know the backend with C# is written in asp.net or something, and will simply be writing APIs that sort the data we need to put on the site
so i can just use 'fetch' or like axios or somethign to get and just put the data in an array and render them into what's needed like a list or something
im hoping thats it, i dont know there's any more 'connections' between the back and the front thats needed
Ai rui 艾瑞
@aisolae
Nov 16 2018 03:53
 <body onload="loadFruit()">
      <p id="fruits"></p>

      <button onclick="changMe()" type="btn3">Add to Favorite</button>
    </body>

    <script>
      var fruits = ['banana', 'apple', 'watermelon', 'egg', 'fish'];
      function loadFruit() {
        document.getElementById('fruits').innerHTML = fruits;
      }
      function changMe() {
        var fruitie = prompt('what fruit do you like?');
        fruits.push() = fruitie;
        document.getElementById('fruits').innerHTML = fruits;
      }
    </script>
i can’t seem to understand why "fruits[fruits.length] = fruitie” works while ". Push()” didn’t
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:55
need to put the stuff you want to push inside push()
@aisolae
so like fruits.push('fruitie')
or whatever you want to add on to the back of the array
Ai rui 艾瑞
@aisolae
Nov 16 2018 03:56
oh
got it
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:56
@aisolae :thumbsup:
Ai rui 艾瑞
@aisolae
Nov 16 2018 03:56
thanks @darkphotonKN
You are awesome
one step at a time
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 03:57
@aisolae thx, haha yep
@aisolae you live in china?? can you speak chinese LOL
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:01
Yeah,
i speak mandarin
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 04:02
that's awesome. i learned mandarin while living in taiwan too
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:02
do you live here too ?
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 04:02
taiwan
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:02
wow
that’s close
guess we could meetup during holiday
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 04:03
yeah man sure, i go to shenzhen sometimes for my dad's business
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:06
wow
nice
shenzhen is 3 hrs from my end
fast train
do you use WeChat?
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 04:08
id: DarkPiggy lol
Albert Cardona II
@daddycardona
Nov 16 2018 04:20
@thekholm80 I spelled your name wrong 150 times to find out I was missing the h LOL how you doing buddy :)
Kyle Holm
@thekholm80
Nov 16 2018 04:23
@daddycardona i'm good, you?
Albert Cardona II
@daddycardona
Nov 16 2018 04:24
I am good still working with electronics I am trying to get back into something programming but as much as I want to I don't want to go javascript anymore. There are so many different things to do plus so many frameworks its overwhelming
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:37
ok, i will add you
Claudio Restifo
@Marmiz
Nov 16 2018 04:38
@darkphotonKN main issue with SSR in react is that you need a Node server. That may add a complexity layer if your BE is in another language
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:38
how do i remove a value from an array by its name
not from back nor from
i thought splice will but it needs two parameter s
Claudio Restifo
@Marmiz
Nov 16 2018 04:39
@aisolae array.filer
*filter
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:39
Ok, thanks
Claudio Restifo
@Marmiz
Nov 16 2018 04:40
['apple', 'banana', 'apple', 'coconut'].filter(el => el !== 'apple')
// ['banana', 'coconut']
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:46
el is element
right ?
Aditya
@ezioda004
Nov 16 2018 04:46
Yes
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:47
   <body onload="loadFruit()">
      <p id="fruits"></p>

      <button onclick="changMe()" type="btn3">Add to Favorite</button>
      <button onclick="remove()" type="btn3">Remove</button>
    </body>

    <script>
      var fruits = ['banana', 'apple', 'watermelon', 'egg', 'fish'];
      function loadFruit() {
        document.getElementById('fruits').innerHTML = fruits;
      }
      function changMe() {
        var fruitie = prompt('what fruit do you like?');
        fruits.push(fruitie);
        document.getElementById('fruits').innerHTML = fruits;
      }

      function remove() {
        var rem = prompt('which would you like to remove?');
        fruits.filter(el => el !== rem);
        // fruits.pop();
        document.getElementById('fruits').innerHTML = fruits;
      }
    </script>
Claudio Restifo
@Marmiz
Nov 16 2018 04:47
@aisolae it's the argument for the filter function. You can call it as you like
also filter return a new array.
your fruits is still the same
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:48
I did call it “fruits.filter(rem)”;
yeah
my fruit is still the same
i was going to say that
Claudio Restifo
@Marmiz
Nov 16 2018 04:49
let new = old.filter(...)
new is the filtered one.
old is still the same
Ai rui 艾瑞
@aisolae
Nov 16 2018 04:51
worked
function remove() {
        var rem = prompt('which would you like to remove?');
        var newFruits = fruits.filter(el => el !== rem);
        // fruits.pop();
        document.getElementById('fruits').innerHTML = newFruits;
      }
Thanks @Marmiz
you are awesome
Claudio Restifo
@Marmiz
Nov 16 2018 04:53
happy to help :smile:
kinopotato
@kinopotato
Nov 16 2018 04:54
I just left my code again and when I came back, it's still not done! Maybe I need to upgrade my cpu, then my code will do what I want
abraham anak agung
@padunk
Nov 16 2018 05:01
dm me the cpu brand if it worked.
kinopotato
@kinopotato
Nov 16 2018 05:05
I think you have to install it on your own head tho
right now, I'm fine with that
Kyle Holm
@thekholm80
Nov 16 2018 05:27
@daddycardona i can understand that. i think it would be interesting to program closer to the hardware, like assembly or machine. there's a steep learning curve there though
Sunil Kumar
@SunilKu94128642_twitter
Nov 16 2018 05:33
Yeah absolutely right.
Aditya
@ezioda004
Nov 16 2018 05:34
@thekholm80 You still on vacation?
Manish Giri
@Manish-Giri
Nov 16 2018 06:02
@ezioda004 x
Aditya
@ezioda004
Nov 16 2018 06:07
lmao
code2038
@code2038
Nov 16 2018 06:13
ren tests doesn't work
Kranti Nebhwani
@darkphotonKN
Nov 16 2018 06:14
@Marmiz what if they don't care that it adds complexity (i was told to just do it anyway, get react to work even with no js state at least to show the basic layout) and i told them i might use SSR which needs node and they said they will work out the backend. Should i just go this path then? As long as it's POSSIBLE that it's SSRed via node and yet the back end is another language
@Marmiz also could you explain whats the difference between frontend using react, rendering with SSR and hence node server, then me using CRUD to a site with an API that allows storing in db that they set up, then for me to do it with our "own" backend?
Beans
@willybeans
Nov 16 2018 06:24
Any tips on preventing my react components from rendering until my async redux thunk is finished?
kinopotato
@kinopotato
Nov 16 2018 07:36
hello, are there any other way of rounding to a specific decimal? .tofixed isn't working :| I tried to do the *100 / 100 as well, but it's not working either
x 1 is 0.31
cid index 1 0.31
change[index][1] 0.20000000000000007
cid index 1 is 0.3
cid index 1 0.3
change[index][1] 0.21000000000000008
cid index 1 is 0.29
cid index 1 0.29
change[index][1] 0.22000000000000008
cid index 1 is 0.27999999999999997 //became a problem here 
cid index 1 0.27999999999999997
change[index][1] 0.2300000000000001
and I used toFixed
if (unpaid - moneyTable[index][1] > 0){
        function updateChange(){
          if (cid[index][1] - moneyTable[index][1] >= 0 && unpaid != 0){
            //60 - 20 > = 40 > 0 yes && 96.74 != 0 yes
          change[index][1] = change[index][1] + moneyTable[index][1];
          change[index][1].toFixed(2);
          //changeIndex1 = 0 + 20
          console.log(`change[index][1] ${change[index][1]}`)
          cid[index][1] = cid[index][1] - moneyTable[index][1];
          console.log(`cid index 1 is ${cid[index][1]}`)
          unpaid = unpaid - moneyTable[index][1];
          unpaid = unpaid.toFixed(2);
          console.log(`cid index 1 ${cid[index][1]}`)
            if (cid[index][1] != 0 && unpaid - moneyTable[index][1] >= 0){
            updateChange();
            }
          }
        }
        updateChange();
      }
  }
Aditya
@ezioda004
Nov 16 2018 07:46
@kinopotato String, Numbers are primitive..no methods can mutate the value, so you'll need to assign the value if you use any method on them.
change[index][1] = change[index][1].toFixed(2);
Though you could do it in previous line:
change[index][1] = (change[index][1] + moneyTable[index][1]).toFixed(2);
kinopotato
@kinopotato
Nov 16 2018 07:48
that didn't work for some reason, so I found this nifty thing
Math.round(num * 100) / 100
I'
I'm soooo closeeeeeee
victory is soooo nearrrrrr
I did it!!! wooooooooooooooooo woooooooooooooooooooo
kinopotato
@kinopotato
Nov 16 2018 07:53
this is also my first time to use a recursion, man this is awesome!
Aditya
@ezioda004
Nov 16 2018 07:53

Math.round(num * 100) / 100

:point_up: November 15, 2018 5:21 PM

Niraj Nandish
@Nirajn2311
Nov 16 2018 07:54
@kinopotato :tada: :tada: time for a victory feast
Aditya
@ezioda004
Nov 16 2018 07:54
First recursion is a great step :sparkles:
kinopotato
@kinopotato
Nov 16 2018 07:54
@ezioda004 yes I saw that yesterday, but for some reason I didn't notice the Math.round part and was just doing x = (x*100)/100 xD
now that you linked it, I see it, hahaha
am I a programmer now? when do I get them ladies????
Niraj Nandish
@Nirajn2311
Nov 16 2018 07:56
@kinopotato congrats you just cleared level 1 of js hell
Aditya
@ezioda004
Nov 16 2018 07:56

programmer, ladies

These 2 words dont go together in a sentence.

Niraj Nandish
@Nirajn2311
Nov 16 2018 07:56
99 more to go
kinopotato
@kinopotato
Nov 16 2018 07:56
me: hello ladies, I have high earning potential
ladies: how much do you make?
me: well 0 smooth
puts on shade due to high earning potential
@Nirajn2311 wouldn't it get easier if I use it only for dom manipulation?
Niraj Nandish
@Nirajn2311
Nov 16 2018 07:58
IDK about DOM yet clearly
kinopotato
@kinopotato
Nov 16 2018 07:59
don't tell me using JS just for html/css shit is difficult O.O
Niraj Nandish
@Nirajn2311
Nov 16 2018 07:59
i have a brain with only 1/10 th knowledge of js compared to @ezioda004
kinopotato
@kinopotato
Nov 16 2018 08:00
we all feel like insects compared to @ezioda004
Aditya
@ezioda004
Nov 16 2018 08:01
I just know some JS, a lot to learn
kinopotato
@kinopotato
Nov 16 2018 08:02
well then . . . I should quit now. haha
segue though, recursion really doesn't make sense to a beginner until he needs to do an infinite amount of if statement
then it just makes sense
Aditya
@ezioda004
Nov 16 2018 08:04
I think Fibonacci sequence is the best example for learning recursion
kinopotato
@kinopotato
Nov 16 2018 08:04
hmm, maybe instead of the addition example (iirc) in FCC teaching recursion, maybe it could be something like that, an unknown amount of times you need to check if the condition has been fulfilled
Aditya
@ezioda004
Nov 16 2018 08:04
Make a tree outta it
kinopotato
@kinopotato
Nov 16 2018 08:04
I don't even remember what I did with the fibonacci
Aditya
@ezioda004
Nov 16 2018 08:05
Theres a fibonacci challenge? I dont recall one :D
kinopotato
@kinopotato
Nov 16 2018 08:05
there is, I didn't use recursion though,
Sum All Odd Fibonacci Numbers
Given a positive integer num, return the sum of all odd Fibonacci numbers that are less than or equal to num.
The first two numbers in the Fibonacci sequence are 1 and 1. Every additional number in the sequence is the sum of the two previous numbers. The first six numbers of the Fibonacci sequence are 1, 1, 2, 3, 5 and 8.
For example, sumFibs(10) should return 10 because all odd Fibonacci numbers less than or equal to 10 are 1, 1, 3, and 5.
Aditya
@ezioda004
Nov 16 2018 08:15
function fibonnaci (num){
  if (num <= 1) return 1;
  return fibonnaci(num-1) + fibonnaci(num-2)
}
function sumFibs(num){
  let sum = 0, n = 0;
  while (fibonnaci(n) < num){
    if (fibonnaci(n) & 1) sum += fibonnaci(n);
    n++; 
  }
  return sum;
}
sumFibs(10); // 10
kinopotato
@kinopotato
Nov 16 2018 08:16
I just did recursion once, doesn't mean I'm not afraid of it anymore
Aditya
@ezioda004
Nov 16 2018 08:20
Its very very inefficient solution but should work, unless theres a time limit
kinopotato
@kinopotato
Nov 16 2018 08:21

this is my code, this is before I learned to comment on my own code

function sumFibs(num) {
let b1 = 1;
let b2 = 1;
let b3 = 0;
let fib = [1, 1];
let result = [];
    for (let i = 1; b3 < num; i++){
      b3 = b1 + b2;
      if (b3 <= num){
      fib.push(b3);
        b1 = b2;
        b2 = b3;
      } 
    }
console.log(fib);
    for (let i = 0; i < fib.length; i++){
      if (fib[i] % 2 > 0){
        result.push(fib[i]);
      }
    }
    function getSum(a,b){
      return a + b;
    }
return result.reduce(getSum);
}
sumFibs(4);

I don't know how it works

Aditya
@ezioda004
Nov 16 2018 08:22
You got a link to the challenge?
Your code seems fine
here's the challenge I think
Aditya
@ezioda004
Nov 16 2018 08:23
Though you could simply use a variable instead of result array
sum+=fib(i)
kinopotato
@kinopotato
Nov 16 2018 08:23
my code seems like it was written by an 8 year-old
anything with that many variable for such a task must be written by someone who is less than 10, in years and in IQ, haha
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:24
@kinopotato thats more or less the same logic i used when i had to write Fibonacci sequence in turbo c++
kinopotato
@kinopotato
Nov 16 2018 08:25
heyyy, are you also 10?
hahaha
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:25
:laughing: :laughing:
kinopotato
@kinopotato
Nov 16 2018 08:25
this is my proudest code
function sumPrimes(num) {
  if (num == 10){
    return 17;
  } else {
    return 73156;
  }
}

sumPrimes(10);
Aditya
@ezioda004
Nov 16 2018 08:26
lmao
kinopotato
@kinopotato
Nov 16 2018 08:27
I know it's borderline "creative coding" but at some point in your life you need to decide whether you need Prime Numbers in your life. And it took me less than a second to decide that I don't
Aditya
@ezioda004
Nov 16 2018 08:28
Sieve of Eratosthenes algorithm isnt hard :P
kinopotato
@kinopotato
Nov 16 2018 08:28
try to say that 3 times really fast then tell me it's not hard
in any case honestly though, I didn't even think of it as easy or difficult, I just decided I don't want it in my life if I can help it. haha
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:34
@ezioda004 that prime number challenge has to have more tests
Aditya
@ezioda004
Nov 16 2018 08:36
You can add more tests but if someone is bent on passing without solving, then for them its only another if statement :joy_cat:
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:37
Then there should be way more tests, in such a way the user will give up with if else for the challenge :laughing: :laughing:
kinopotato
@kinopotato
Nov 16 2018 08:37
to be fair, I only did that kind of code for that specific test
@Nirajn2311 have you decided yet that you want prime numbers in your life or not? when that moment comes, you will understand. . .
hahahaha
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:38
Hey, i like maths, dont insult it or the :fox: will go mad
kinopotato
@kinopotato
Nov 16 2018 08:39
nah man, I don't hate math nor do I have anything negative against it.
it just means that that decision has come for you and you want prime numbers in your life
Aditya
@ezioda004
Nov 16 2018 08:40
One way I could think of is not showing what value is being passed the function so the output will be discrete but that would create another issue for genuine debugging, so cant do that.
@kinopotato I'll take prime number any day over gradient descent algorithm
kinopotato
@kinopotato
Nov 16 2018 08:41
I have this feeling that I might do the same when I encounter something that sounds so serious
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:41
I like prime numbers
kinopotato
@kinopotato
Nov 16 2018 08:42
there's a group that "lends" their cpu power to compute the largest prime numbers right?
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:42
@ezioda004 why arent the tests hidden
Aditya
@ezioda004
Nov 16 2018 08:43
Some platforms have tests hidden - fcc never did that. So thats a question for core members.
I wont mind codewars approach, x tests are shown, y are hidden
Niraj Nandish
@Nirajn2311
Nov 16 2018 08:44
Hmm, ill ask that the next time one of the core members are online
bye y’all
@kinopotato have fun with js :laughing:
kinopotato
@kinopotato
Nov 16 2018 08:45
individual challenges are irrelevant though for the cert, you only need to do the last projects for the certificate. so yeah if someone wanted to do it like how I did it, it might be spending too much resources
@Nirajn2311 thanks dude, good luck to all of us
Aditya
@ezioda004
Nov 16 2018 08:46
Actually now that I think of it, the certificate algorithm should have some hidden tests to ensure that if statements dont pass it
That'd add more credibility to the certificate
kinopotato
@kinopotato
Nov 16 2018 08:46
that's true, though I don't know if someone will actually really do that. there's a ton of tests with the last projects
hmm,
at least for the first ones, this last one maybe only have 7 tests?
Aditya
@ezioda004
Nov 16 2018 08:48
Random tests too cause people can see the tests on github :D
kinopotato
@kinopotato
Nov 16 2018 08:49
in the end, don't employers just look at the portfolio of someone who has FCC cert instead of actually acknowledging the cert? That's just my impression though
so if someone has fcc cert and nothing to demonstrate, then validity of cert won't matter either way. that's just an uninformed opinion though
Aditya
@ezioda004
Nov 16 2018 08:51
Certs definitely have some value, but yes portfolio >>>> certificates
kinopotato
@kinopotato
Nov 16 2018 08:52
speaking of certs, now that I have html/css/js from fcc, does this mean that I have at least 600 hours of experience?
I mean it's not much, but still it's something maybe??
Aditya
@ezioda004
Nov 16 2018 08:52
You have 2 certificates? Yeah you can say you have 600hrs of learning* experience
I dont even have CSS certificate lol
kinopotato
@kinopotato
Nov 16 2018 08:55
yasss, meaning I can school you on css?! hwe hwe hwe
I doubt it though, tbh I don't remember css syntax anymore
Aditya
@ezioda004
Nov 16 2018 08:56
Yeah CSS aint my strongest suit, my projects are like JS done in 2hrs, CSS done in 2 days
kinopotato
@kinopotato
Nov 16 2018 08:58
what do I do now :| definitely I need to learn JS DOM manipulation
but what then? I need to make a website (ecommerce) and launch by Feb
Aditya
@ezioda004
Nov 16 2018 08:59
Learn DOM then?
You'll also need to learn a frontend framework though
Like React, Vue, Angular
kinopotato
@kinopotato
Nov 16 2018 09:00
wordpress, hwe hwe hwe
at least that's what everyone said, WP with woocommerce
so much to cram and new things to learn,
Aditya
@ezioda004
Nov 16 2018 09:00
Oh then, you should be fine after learning DOM
I dont think WP even requires HTML/CSS/JS knowledge
kinopotato
@kinopotato
Nov 16 2018 09:01
I want to learn react/react native. but I really need to launch that site.
you'd have advatanges though if you know the 3 basics while using wp right???
Aditya
@ezioda004
Nov 16 2018 09:02
No clue, never did any WP development but the people I know who do WP doesnt know JS so theres that
If you know React then React native is trivial
kinopotato
@kinopotato
Nov 16 2018 09:03
well if I'm to be a freelancer, I'd need to know PHP anyway, sigh. But at least know those 4 I can earn while learning the other stuff
well this means I can finally play warframe again! wohoooo
Darren
@DarrenfJ
Nov 16 2018 09:04
@Nirajn2311 yes sir.. living the life in the 6ix :wink:
Claudio Restifo
@Marmiz
Nov 16 2018 09:05

@darkphotonKN it's actually common to have a server that handles the render logic, and another that handles the business logic (api , db ...)

SSR is nothing new actually... it's how website used to be: a markup that gets sent to the client to be displayed. In this case is just generated on the fly.
the thing is, you will likely still need to fetch some data from an API to fill the page with content.

The prime example is an app like Facebook. Try blocking your data only for that. You'll see that you have the layout, but no content :)

Aditya
@ezioda004
Nov 16 2018 09:05
@kinopotato Yep, goodluck learning. I'm out for now, see ya
kinopotato
@kinopotato
Nov 16 2018 09:06
@ezioda004 thanks dude! You've been so much help with this!
kinopotato
@kinopotato
Nov 16 2018 09:14
seriously tho, thanks to everyone that helped me or replied to my questions :)
Kyle Holm
@thekholm80
Nov 16 2018 14:17
@ezioda004 :point_up: November 15, 2018 10:34 PM nope
Aditya
@ezioda004
Nov 16 2018 14:26
@thekholm80 Dont see you around anymore, busy?
Kyle Holm
@thekholm80
Nov 16 2018 14:31
a bit. some shake-ups at work are making my life busier
七染天
@lpl0614
Nov 16 2018 14:34
请问font-size怎么用
h1 {
font-size: 30px;
}
style="font-size:16px"
Aditya
@ezioda004
Nov 16 2018 14:36
@thekholm80 Ah, hope everything gets stable soon so you can hang with us often!
七染天
@lpl0614
Nov 16 2018 14:37
how font-size use?
how does font-size use?
Aditya
@ezioda004
Nov 16 2018 14:39
style="font-size:16px" this seems wrong, is it suppose to be in some element?
七染天
@lpl0614
Nov 16 2018 14:40
let me see......
<p class="red-text"style="font-size:16px">在大家心目中,猫是慵懒的可爱的化身,它可以睡饱了再起来吃饭,可以逗趣小耗子,可以卖得了萌,使得了坏,这样百变的小怪兽就集结在一只宠物上,怎能不惹人怜爱。</p>
<p style="color:red"style="font-size:16px">养动物有的时候,就是介于爱与恨之间,当你钦羡别人萌宠这么可爱的时候,你一定没有想过,狗狗和猫猫会到处拉屎,甚至会屯老鼠,啃鞋子,用爪子爬门,你不理它,它就挠你,你要对它发脾气,它会比你更来劲。所以,狗猫慎入,没有一定的准备,切勿随便去侍养动物。它们一旦认定你了,你就是它们的主人,如果你抛弃它们,它们必定心中重创。</p>
Are they different?
Aditya
@ezioda004
Nov 16 2018 14:41
Sorry, dont know chinese, try the chinese room
七染天
@lpl0614
Nov 16 2018 14:42
Exclude the contents of paragraphs
okok
thank you
May Kittens Devour Your Soul
@diomed
Nov 16 2018 16:47
damn Chinese Elon Musc
七染天
@lpl0614
Nov 16 2018 16:48
You shouldn't say that.
May Kittens Devour Your Soul
@diomed
Nov 16 2018 16:49
oops. looks like you know english
how come you dont participate in english FCC, then
idris
@idris12
Nov 16 2018 16:50
whats the best way to go about doing this result in js
if a user enters
1= 1

if a user enters 2
2= 1
2 2

3= 1
2 2
3 3 3

and so on
Aditya
@ezioda004
Nov 16 2018 16:52
Like a steps or pyramid?
idris
@idris12
Nov 16 2018 16:53
yes
like a pyramid
Christopher McCormack
@cmccormack
Nov 16 2018 16:58
a for loop should be easy enough, starting from 1 and ending with the value entered, then an inner for loop that displays the iterator, iterator times
May Kittens Devour Your Soul
@diomed
Nov 16 2018 16:59
@cmccormack pls help me
Christopher McCormack
@cmccormack
Nov 16 2018 17:00
@diomed wha?
May Kittens Devour Your Soul
@diomed
Nov 16 2018 17:02
@cmccormack see this drawer? instead of getting it back, as it's lenght is, I had a sim card, and entered it in mobile phone
this later proved to be a big mistake
Christopher McCormack
@cmccormack
Nov 16 2018 17:11
so the release mechanism isn't working? Sim maybe jammed?
idris
@idris12
Nov 16 2018 17:11
@cmccormack this is what i got
iterata.PNG
May Kittens Devour Your Soul
@diomed
Nov 16 2018 17:11
yes, sim is most deff jamed, coz I put it wrong way. lol
idris
@idris12
Nov 16 2018 17:11
but i want when i write 3
Christopher McCormack
@cmccormack
Nov 16 2018 17:12
work on that indenting :)
idris
@idris12
Nov 16 2018 17:12
i want to get
1
2 2
3 3 3
Christopher McCormack
@cmccormack
Nov 16 2018 17:12
j should equal i
not 1
idris
@idris12
Nov 16 2018 17:15
ok i did that
WhatsApp Image 2018-10-22 at 3.02.06 PM.jpeg
like that
May Kittens Devour Your Soul
@diomed
Nov 16 2018 17:24
@idris12 wtf do you need that thing for?
idris
@idris12
Nov 16 2018 17:26
am practicing
my javascript so i can strengthen my logic in it
Beans
@willybeans
Nov 16 2018 18:18
Any good resources for learning react native? Currently looking into one on Lynda.com. wondering if there are any more in that hive mind of yours :)
Michael Bomholt
@bomholtm
Nov 16 2018 21:17
Hey… I was wondering. Is it okay to use different but similar datasets for the data visualization projects?
May Kittens Devour Your Soul
@diomed
Nov 16 2018 21:17
I dont see why not
Michael Bomholt
@bomholtm
Nov 16 2018 21:18
I guess it should be fine as long the user stories are still eoing fullfilled
May Kittens Devour Your Soul
@diomed
Nov 16 2018 21:18
yes
Michael Bomholt
@bomholtm
Nov 16 2018 21:19
okay then i will use my own datasets :P more work… also more fun though
Barbara Pentoney
@flyfishingbarbara
Nov 16 2018 21:56
hi.... cacn someone help me figure out how my 'matchstick' can stay 'lit' at the end of the animation...its for codevember challenge for 11/15...thns
https://codepen.io/flyfishingbarbara/pen/mQMJQq
Barbara Pentoney
@flyfishingbarbara
Nov 16 2018 22:04
nvmd i figured it out....
Henry
@GitHub-Henry
Nov 16 2018 23:57
I just noticed the icon, representing the file type, when writing a JS import statement, pretty cool.