These are chat archives for FreeCodeCamp/Help

20th
Nov 2017
Luke Al-Saba
@LukeAlSaba
Nov 20 2017 00:01
Hi, has anyone here used Babel?
Ken Haduch
@khaduch
Nov 20 2017 00:02
using it in a React context - why?
Luke Al-Saba
@LukeAlSaba
Nov 20 2017 00:04
Well I'm making a portfolio website and I am using ES6 and transpiling it with Babel
and my question is
do i use the transpiled js on my website or do i use the ES6 js code?
Ken Haduch
@khaduch
Nov 20 2017 00:07
@LukieID - good question - I'm doing a course on React, and haven't gotten to the part about how to package the code for "release" - I'm kind of thinking that you would send out the transpiled code - it would seem to be the case that you wouldn't want to transpile it every time someone loaded the page? I'm sure that there are people here who have gotten far enough along to give a correct answer.
Luke Al-Saba
@LukeAlSaba
Nov 20 2017 00:08
Ok, thanks! What course are you doing?
Abdelmalek LAHMAR
@malix213
Nov 20 2017 00:09
hi
i did audit page using chrome dev tool
on codepen page
i mean my html page
on codepen
i need to put maifest file to perfom best parctice
is it possible
Ken Haduch
@khaduch
Nov 20 2017 00:50
@LukieID - as I've been thinking about your question and doing some reading - if you are just using Babel with ES6 code, I think that you could see what the support level is for the ES6 features that you are using and if browsers directly support what you are doing, then why transpile? I was thinking of what I'm learning with React, where it is transpiling JSX code, which might be a different situation than what you are doing with strictly ES6? I don't know if that helps you?
ehutchllew
@ehutchllew
Nov 20 2017 01:00
@LukieID Use transpiled.
Ken Haduch
@khaduch
Nov 20 2017 01:02
@ehutchllew - could you explain - and thanks for replying...
CamperBot
@camperbot
Nov 20 2017 01:02
khaduch sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
:cookie: 360 | @ehutchllew |http://www.freecodecamp.org/ehutchllew
ehutchllew
@ehutchllew
Nov 20 2017 01:04
@khaduch Granted I've only recently started my professional career, however, from what I gather is that many browsers do not support ES6 syntax, thus we have babel. So in order for your JS to work properly on the web (it would be fine if you were using server side for instance), you need to use whatever babel's output is. There are various ways to do this, but I've used webpack to implement the babel 'translation' and bundle all my dependencies into one Bundle.js file.
Ken Haduch
@khaduch
Nov 20 2017 01:09
@ehutchllew - okay, that makes sense. I guess that I was not aware that most browsers aren't supporting ES6 syntax - although I suspect that could be the case. Although it does look like there is a lot of support if you look at http://caniuse.com - hard to know what you'd run into in actual use though as far as browser revisions that are out there. Thanks for the response!
CamperBot
@camperbot
Nov 20 2017 01:09
khaduch sends brownie points to @ehutchllew :sparkles: :thumbsup: :sparkles:
api offline
ehutchllew
@ehutchllew
Nov 20 2017 01:11
@khaduch Yeah, IE seems to always lag behind. I've watched some videos where they say to actually just use industry leading tech even if it doesn't work on some browsers, that way if we all start doing that, it forces them to catch up and we can all just move along.
Ken Haduch
@khaduch
Nov 20 2017 02:13
@klai38 - dot notation can be used in a case where you have an appropriate property name that is part of the object, and you can write the code to access it. So you can write myObj.friend1 because "friend1" is a property, you can write this literal expression to access it. The same for myObj.friend2. And myFriend.age. According to the documentation of objects, valid names that you can use dot notation for properties that are valid - they say "a sequence of alphanumerical characters, also including the underscore and dollar sign, that cannot start with a number." So if you have a property that fits those requirements, you can use dot notation to write a literal expression to access the object. The documentation is here. They point out that myObj.1 would not be valid.
Claudio Restifo
@Marmiz
Nov 20 2017 02:30

@khaduch when shipping React code to production, the general "default" behaviour is to compile/transpile the code (mind that besides ES6 there are also a bunch of polyfills and of course JSX) as well as bundling static files, and in case you've set up, code splitting.

By the end you should have a working optimised version of your app that you can simply upload to any server for it to serve.

Ken Haduch
@khaduch
Nov 20 2017 02:52
@Marmiz - thanks for that info. That was my intuition on this (as far as React programming is concerned) I just haven't gotten thru my course far enough to see the final production code generation. But the original question that was posted above didn't lead me to believe that it was React (or not necessarily react) that was being used, but ES6 was mentioned. So that moved me into a gray area where I think that ES6 could be supported by browsers - but perhaps features that aren't fully implemented need transpiled help... I don't know if there will be added information from the original questioner? But I appreciate any input because I'm in a learning mode about this, too!
CamperBot
@camperbot
Nov 20 2017 02:52
khaduch sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1101 | @marmiz |http://www.freecodecamp.org/marmiz
Claudio Restifo
@Marmiz
Nov 20 2017 02:58

@khaduch many modern browsers support ES6 out of the box (just go into your browser console and try to use Object.assign for example) but not all, that's why a transpiler like Babel exists.

Then as far as React goes, you still need one that "converts" your JSX into good 'ol html :)

Dylan Mayers
@DylanMayers
Nov 20 2017 04:00
Does anyone know how to remove an unwanted window in Sublime 3? I was installing a theme and had to edit my user settings in preferences to activate the theme but now I have a second window that i can't get rid off
Darren
@DarrenfJ
Nov 20 2017 06:02
evening fCC
@khaduch re babel.. I found this article an amazing overview of all the grunts and babels out there. some of which I've heard about and some of which I've ignored ;)
i almost feel like fCC should have an intro to tools or something
myblogsinchina
@myblogsinchina
Nov 20 2017 07:01
Can you tell me how to deal with the Q:106. I had tried my best.....to do. thanks....
Henry
@GitHub-Henry
Nov 20 2017 08:20
@DarrenfJ nice article, thanks for sharing, :shipit: :dizzy:
CamperBot
@camperbot
Nov 20 2017 08:20
github-henry sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2281 | @darrenfj |http://www.freecodecamp.org/darrenfj
Henry
@GitHub-Henry
Nov 20 2017 13:23
Anyone using FF Dev Edition, thoughts about it would be appreciated.
gishy1
@gishy1
Nov 20 2017 14:01
@DarrenfJ so you mean var i=size instead of var i=0
Supra01
@Supra01
Nov 20 2017 14:02
Hello I'm working on the random quote machine project. I got it to work on code pen but when I work on it locally the quote api won't generate a quote. When I check my devtools on chrome I get this: No 'Access-Control-Allow-Origin' header is present on the requested resource
I was wondering if anyone could help me understand why this is happening.
rscales02
@rscales02
Nov 20 2017 14:23
when you use setInterval(function(), 5000) that should delay for 5 seconds before running the first time, correct?
Long Nguyen
@longnt80
Nov 20 2017 14:36
5sec between interval, not the first time
rscales02
@rscales02
Nov 20 2017 14:39
So it triggers a time = 0, 5, 10, ... not time = 5, 10, 15, ...?
karinafarina
@karinafarina
Nov 20 2017 14:43
How do you get past a bug
rscales02
@rscales02
Nov 20 2017 14:53
@karinafarina you want to skip over the bug?
karinafarina
@karinafarina
Nov 20 2017 14:54
@rscales02 , the correct answer won't work so yes, I want to skip to the next exersice.
rscales02
@rscales02
Nov 20 2017 14:55
if you want to skip to the next exercise, navigate to it in the map... what exercise are you working on?
@rscales02 there is a bug in it
But thank you! I canskip it now!
Kaz Baig
@kbaig
Nov 20 2017 15:04
Yeah the first three requirements aren't passing for some reason
karinafarina
@karinafarina
Nov 20 2017 15:04
Right
rscales02
@rscales02
Nov 20 2017 15:07
@karinafarina fuck this stuff changes fast... I started not terribly long ago and now they are already teaching this in a new magical dialect... but I guess the not passing goes along with you being a beta guinea pig :smile:
Kaz Baig
@kbaig
Nov 20 2017 15:08
@rscales02 Are you referring to ES6?
karinafarina
@karinafarina
Nov 20 2017 15:08
Lol, true
rscales02
@rscales02
Nov 20 2017 15:10
@kbaig that I am
Long Nguyen
@longnt80
Nov 20 2017 15:16
@rscales02
fuck this stuff changes fast
Welcome to front end development
Kaz Baig
@kbaig
Nov 20 2017 15:19
@rscales02 It's been around for 2 and a half years though
Moisés Man
@moigithub
Nov 20 2017 15:23
ES8 is already out if i recall
Kaz Baig
@kbaig
Nov 20 2017 15:24
yep this summer
Ken Haduch
@khaduch
Nov 20 2017 15:44
@DarrenfJ - thanks for posting that article :point_up: November 20, 2017 1:02 AM - - I couldn't find the right search on Google to get that information. I'll have to bookmark that one for future reference!
CamperBot
@camperbot
Nov 20 2017 15:44
khaduch sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2282 | @darrenfj |http://www.freecodecamp.org/darrenfj
Ken Haduch
@khaduch
Nov 20 2017 15:52
@LukieID - I didn't see your question until I was scrolling back today - :point_up: November 19, 2017 7:08 PM - I'm doing one of the udemy courses "complete react developer 2nd edition" I think that it has been pretty good - the challenge will be to see if I can design a site using it afterward, because even though he gives "challenges" to do throughout the lessons, there is a lot of material and new information that will take time to get accustomed to...
Supra01
@Supra01
Nov 20 2017 16:05
Has anyone built the random quote machine project on localhost instead of codepen?
Kaz Baig
@kbaig
Nov 20 2017 16:17
@Supra01 what's up
Supra01
@Supra01
Nov 20 2017 16:23
@kbaig I got it to work on code pen but when I work on it locally the quote api won't generate a quote. If i inspect with my chrome devtools this pops up: Failed to load https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1&callback=: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
TLDR is your browser doesn't allow requests to an domain other than your own
Supra01
@Supra01
Nov 20 2017 16:32
thank you @kbaig I'll give it a read
CamperBot
@camperbot
Nov 20 2017 16:32
supra01 sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 433 | @kbaig |http://www.freecodecamp.org/kbaig
Kaz Baig
@kbaig
Nov 20 2017 17:03
@Supra01 yw
:D
Albert Cardona II
@daddycardona
Nov 20 2017 17:51
what up everyone
is anyone here good with excel I am okay with it but I was needing some help using a customizable sort or filter
Kaz Baig
@kbaig
Nov 20 2017 17:55
@daddycardona :wave: I can give it a go
Unless you mean using VBA, in which case no thanks
Albert Cardona II
@daddycardona
Nov 20 2017 18:08
no i am just trying to figure out how can I customize certain things like I have a rank structure like pvt pfc up to general and I wanted to make a specific customization
like general being 1 down to pvt being 29
or 20
@kbaig
Kaz Baig
@kbaig
Nov 20 2017 18:11
@daddycardona off the top of my head, you could create a sheet that has what each rank corresponds to. Then you would add a vlookup to your original sheet and sort by that
I'm sure there's a better way to do it but that's a straightforward method
Albert Cardona II
@daddycardona
Nov 20 2017 18:11
how do you do that ?
Kaz Baig
@kbaig
Nov 20 2017 18:11
So general 1 etc as you said
Which part
Albert Cardona II
@daddycardona
Nov 20 2017 18:12
the lookup like is there a video you can link me to o and thanks @kbaig
CamperBot
@camperbot
Nov 20 2017 18:12
daddycardona sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 435 | @kbaig |http://www.freecodecamp.org/kbaig
Kaz Baig
@kbaig
Nov 20 2017 18:12
If you're familiar with SQL, it's basically a table join
Albert Cardona II
@daddycardona
Nov 20 2017 18:13
so you can do that on excel
Darren
@DarrenfJ
Nov 20 2017 18:13

@gishy1 sorry for the delay in replying.. i mean more like in stead of i++ go i+(size of chunk) i.e. for (var i = 0, i < arr.length; i + (size of chunk)) {} then i pushed the slice of that chunk into a empty array for building the chunked answer..

@DarrenfJ so you mean var i=size instead of var i=0

also hello all! :D
Albert Cardona II
@daddycardona
Nov 20 2017 18:14
:wave: :wavy_dash: @DarrenfJ
Darren
@DarrenfJ
Nov 20 2017 18:15
@daddycardona hey buddy! :D
Albert Cardona II
@daddycardona
Nov 20 2017 18:16
trying to figure somehting out went on dreamincode because they usually nicer then stackoverflow lol
nope LOL
Kaz Baig
@kbaig
Nov 20 2017 18:17
@daddycardona Yeah vlookup is basically a sql join
Albert Cardona II
@daddycardona
Nov 20 2017 18:18
according to this documentation and what I want is not the same thing I am trying to do
Darren
@DarrenfJ
Nov 20 2017 18:18
@daddycardona never heard of dreamincode? good site?
Albert Cardona II
@daddycardona
Nov 20 2017 18:19
yes it is basically another slightly nicer people version of stackoverflow lol
karinafarina
@karinafarina
Nov 20 2017 18:19
Can someone tell me what I am doing wrong here?

(function() { 'use strict'; }());

function increment(number, value) {
return number + value;
if(value == nul) {
return number + 1;
}
}

Kaz Baig
@kbaig
Nov 20 2017 18:20
@daddycardona I am saying you gotta make a sheet first that has one column with the titles, like general, pvt, etc and the other with the corresponding rank
So row 1 might be general, 1
Albert Cardona II
@daddycardona
Nov 20 2017 18:21
i think use strict is suppose to be first @karinafarina like `'use strict' function () so forth I may be wrong
Kaz Baig
@kbaig
Nov 20 2017 18:21
@karinafarina null has 2 l's
and also your if statement will never be executed
Albert Cardona II
@daddycardona
Nov 20 2017 18:21
oh good catch lol
Kaz Baig
@kbaig
Nov 20 2017 18:22
because you're always returning beforehand
Also, you want to use ===, not == here
As passing 0 or false as value would return true
Ken Haduch
@khaduch
Nov 20 2017 18:22
@daddycardona - and looks like null is not spelled correctly...
oops, I see that @kbaig mentioned that.
karinafarina
@karinafarina
Nov 20 2017 18:23
@kbaig what do you mean by alway returning beforehand
Albert Cardona II
@daddycardona
Nov 20 2017 18:23
okay let me get this straight Kaz, I have to make a spreasheet of what I want, then another one of how I want it to be structure, then use the vlookup @kbaig
Kaz Baig
@kbaig
Nov 20 2017 18:23
@daddycardona the function wrapper for use strict is something required for the beta site for some reason
Albert Cardona II
@daddycardona
Nov 20 2017 18:23
you have a return statement before your if statement
@karinafarina
Kaz Baig
@kbaig
Nov 20 2017 18:24
@daddycardona could you mock up a sheet of what you have and screenshot it or something? Might be better to show you
Albert Cardona II
@daddycardona
Nov 20 2017 18:24
oh okay I was confused I have not been on beta yet
okay
blob
okay that is my main sheet :)
blob
Kaz Baig
@kbaig
Nov 20 2017 18:25
They require 'use strict'; supposedly to enable ES6 for some browsers, and I think the function version to get it to execute using the package they're using
Albert Cardona II
@daddycardona
Nov 20 2017 18:25
this is they way I want them to be sorted so if I want to add another person it can get sorted easily
Darren
@DarrenfJ
Nov 20 2017 18:26
ok godd run gonna check out dreamincode
Kaz Baig
@kbaig
Nov 20 2017 18:26
@karinafarina Your return statement is before the if, so the function ends there every time
Darren
@DarrenfJ
Nov 20 2017 18:26
thanks @daddycardona for that one :D
CamperBot
@camperbot
Nov 20 2017 18:26
darrenfj sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 491 | @daddycardona |http://www.freecodecamp.org/daddycardona
Albert Cardona II
@daddycardona
Nov 20 2017 18:26
you welcome brother :)
Kaz Baig
@kbaig
Nov 20 2017 18:29
@daddycardona okay so first thing to do is to reverse the order of columns in the second sheet
Albert Cardona II
@daddycardona
Nov 20 2017 18:29
okay
Kaz Baig
@kbaig
Nov 20 2017 18:30
Then create a column in your first table called rank number or something like that
Albert Cardona II
@daddycardona
Nov 20 2017 18:30
Rank Num
Kaz Baig
@kbaig
Nov 20 2017 18:33
And then for row 2, use the following formula:
=vlookup(A2, 'Rank Table'!$A$2:$B$13, 2, False)
And then drag that down for the whole table
And sort the table by that value
This is saying look for the value found in A2 in the Rank Table sheet, and return the value in the second column of the row where it A2 matches. The last param is for looking for approximate matches if True
False means exact match
Albert Cardona II
@daddycardona
Nov 20 2017 18:35
so was I suppose to put the number first or second I am confused because i got 0 all the way down
Kaz Baig
@kbaig
Nov 20 2017 18:36
In your DATABASE SHEET sheet, it can be anywhere. In your RANK TABLE sheet, it has to be second
Albert Cardona II
@daddycardona
Nov 20 2017 18:37
blob
Kaz Baig
@kbaig
Nov 20 2017 18:37
change A2 to A3 in your first param
You have to look up the value in the Rank col for that row
sorry
I meant B2
Not A3
Albert Cardona II
@daddycardona
Nov 20 2017 18:41
okay :)
Kaz Baig
@kbaig
Nov 20 2017 18:43
heh I knew my degree would be useful some day
Albert Cardona II
@daddycardona
Nov 20 2017 18:50
thanks a lot that worked perfectly :)
Kaz Baig
@kbaig
Nov 20 2017 18:51
@daddycardona no problem :) always happy to use something I know already know for once
karinafarina
@karinafarina
Nov 20 2017 18:58
I still can't figure this out.

(function() { 'use strict'; }());

function increment(number, value) {

if(value === null) {
  return number + 1;
}else{
  return number + value;
}

}

so if I do increment(5) shouldn't it return 6?
Kaz Baig
@kbaig
Nov 20 2017 19:02
karinafarina
@karinafarina
Nov 20 2017 19:04
Thank you @kbaig !!!
CamperBot
@camperbot
Nov 20 2017 19:04
karinafarina sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 438 | @kbaig |http://www.freecodecamp.org/kbaig
Kaz Baig
@kbaig
Nov 20 2017 19:06
@karinafarina mhmm
karinafarina
@karinafarina
Nov 20 2017 19:20
Sorry to keep bugging everyone but I don't understand this one at all.
https://beta.freecodecamp.org/en/challenges/es6/use-the-rest-operator-with-function-parameters
Kaz Baig
@kbaig
Nov 20 2017 19:21
@karinafarina Which part are you struggling with
karinafarina
@karinafarina
Nov 20 2017 19:23
I just don't understandwhat Iam supposed to do
Kaz Baig
@kbaig
Nov 20 2017 19:23
Well, there are two components to the problem
The rest operator
And the arguments object
How are you doing with both
karinafarina
@karinafarina
Nov 20 2017 19:25

(function() { 'use strict';}());

function sum(...args) {
const array = [ x, y, z ];
return array.reduce((a, b) => a + b, 0);
}
console.log(sum(1, 2, 3)); // 6

this is what I have so far
but i don' t even thin it's right at all
Kaz Baig
@kbaig
Nov 20 2017 19:25
The problem says not to change the parameters of the function
kind of implicitly but yeah
karinafarina
@karinafarina
Nov 20 2017 19:26
ok
Kaz Baig
@kbaig
Nov 20 2017 19:26
Well here's one thing they say
Change it so that it does the same thing, no matter how many parameters are passed in
So you don't actually need any params defined in the function
If you want to change it, you could make it function sum () {
You can still refer to the passed args using the arguments object
karinafarina
@karinafarina
Nov 20 2017 19:32
Where would the arguments object go?
Kaz Baig
@kbaig
Nov 20 2017 19:33
well you're storing your arguments in an array right
before doing something to it
karinafarina
@karinafarina
Nov 20 2017 19:35
I guess I also don't understand the .reduce part. What do a and b refer to?
The whole thing is a mystery to me
Kaz Baig
@kbaig
Nov 20 2017 19:35
(a, b) => a + b is the equivalent of
function (a, b) {
  return a + b;
}
karinafarina
@karinafarina
Nov 20 2017 19:36
That makes sense, the arrow thing
Arrow functions from before
Kaz Baig
@kbaig
Nov 20 2017 19:36
mhmm arrow functions with implicit return
you don't need to worry about the reduce for this problem
karinafarina
@karinafarina
Nov 20 2017 19:37
how can i not?
Kaz Baig
@kbaig
Nov 20 2017 19:37
You only need to change the array constant that's being used
because that is determining the value that are being used in the reduce
karinafarina
@karinafarina
Nov 20 2017 19:38
so argument.length?
Kaz Baig
@kbaig
Nov 20 2017 19:38
no
you need to create an array
that has all the arguments passed
using the rest operator
arguments.length gives how many args are passed
karinafarina
@karinafarina
Nov 20 2017 19:39
I am missingthe rest operator
It doesn't say exactly what the rest operator is
Gustavo Santana
@santanaG
Nov 20 2017 19:42
Where in the react code can I see when a lifecycle Hook is called?
Kaz Baig
@kbaig
Nov 20 2017 19:43
@santanaG it's methods in the component like componentWillUpdate and componentDidMount
Those methods are the lifecycle hooks
Gustavo Santana
@santanaG
Nov 20 2017 19:44
Yes, but I am searching through the code and am searching for specifically those and do not find them references
referenced*
Kaz Baig
@kbaig
Nov 20 2017 19:44
If they're not being explicitly referenced, they're not being called
Gustavo Santana
@santanaG
Nov 20 2017 19:44
as in: These methods get called at particular times, how does react know when to call them?
Kaz Baig
@kbaig
Nov 20 2017 19:44
There is an order to them
Gustavo Santana
@santanaG
Nov 20 2017 19:45
Yes, but what decides that order and what executes them when they are available?
I dont mean rules wise I know why they are called in the order they are called
I guess what I am looking for in the code is:
The order is predetermined by React, not sure what you mean
Gustavo Santana
@santanaG
Nov 20 2017 19:47
// component is ready to mount
// If this.componentWillMount exists
// Run this.componentWillMount
something to that effect within the code
Kaz Baig
@kbaig
Nov 20 2017 19:48
That's all handled by react
Gustavo Santana
@santanaG
Nov 20 2017 19:48
Within the react source code I mean
Kaz Baig
@kbaig
Nov 20 2017 19:48
OH
Gustavo Santana
@santanaG
Nov 20 2017 19:53
Any thoughts?
Kaz Baig
@kbaig
Nov 20 2017 19:53
I haven't read the source code sorry haha
karinafarina
@karinafarina
Nov 20 2017 20:41

I still don't understand what I am doing wrong.
(function() { 'use strict';}());

function sum(x, y, ...theArgs) {
const array = [x, y, z];
return array.reduce((a, b) => a + b, 0);
}
console.log(sum(1, 2, 3)); // 6

Kaz Baig
@kbaig
Nov 20 2017 20:45
What do you think the rest operator is doing here
karinafarina
@karinafarina
Nov 20 2017 20:46
making the arguments unlimited.
Kaz Baig
@kbaig
Nov 20 2017 20:46
no that's the default for any function
You don't need it in your parameter definitions, you need it within the function
function a () {
return [...arguments]
}

a('hello', 'world', 'a', 'b', 'c'); // ['hello', 'world', 'a', 'b', 'c']
does this help?
karinafarina
@karinafarina
Nov 20 2017 20:49
Yes, thanks again!! I hate Javascript
Kaz Baig
@kbaig
Nov 20 2017 20:49
You just don't know that you love it yet ;) @karinafarina
karinafarina
@karinafarina
Nov 20 2017 20:49
I mean i hate learning js
Yes, I can't wait
Kaz Baig
@kbaig
Nov 20 2017 20:50
Life is easier if you learn ES5 first
karinafarina
@karinafarina
Nov 20 2017 20:50
I did but suck at it
Kaz Baig
@kbaig
Nov 20 2017 20:50
Well ES6 is just ES5 + more things
So you're going to have a worse time with it
And your fundamentals could be weaker
karinafarina
@karinafarina
Nov 20 2017 20:52
I have tried to learn js several times and understand a lot of what I see but have a very hard time figuring out how to do things myself.
Kaz Baig
@kbaig
Nov 20 2017 20:52
Maybe working on the basic/intermediate front end projects and algorithms will help?
Kyle Holm
@thekholm80
Nov 20 2017 20:53
the best thing for that is to write a lot of code
then write a lot more
Kaz Baig
@kbaig
Nov 20 2017 20:53
^ for that reason
karinafarina
@karinafarina
Nov 20 2017 20:53
good idea
Kyle Holm
@thekholm80
Nov 20 2017 20:54
i wish i could give a better suggestion, but for me none of it really made sense until i had done A TON of projects
Kaz Baig
@kbaig
Nov 20 2017 20:54
I like to think of a lot of acquired skills (especially self-taught ones) as learning how to suck less
Makes it feel less daunting ;)
Kyle Holm
@thekholm80
Nov 20 2017 20:55
lol
karinafarina
@karinafarina
Nov 20 2017 20:55
That makes sense. Thank you , really for all the help and suggestions.
lol
Kaz Baig
@kbaig
Nov 20 2017 20:55
It's just more self-centric that way
karinafarina
@karinafarina
Nov 20 2017 20:55
Thank you both
Kyle Holm
@thekholm80
Nov 20 2017 20:56
codewars helped me a bunch, too because i could see other people's solutions and learn how to improve my code that way
karinafarina
@karinafarina
Nov 20 2017 20:56
I will look into that
Kaz Baig
@kbaig
Nov 20 2017 20:57
@thekholm80 I was doing codefights but you need to spend coins to see solutions before you solve, idk how it is in codewars
I stopped once it became all about regex lol
Kyle Holm
@thekholm80
Nov 20 2017 20:57
codewars let you see other solutions after you solve each kata
and vote on which is the 'best' solution
it's humbling to submit my 50 lines of crappy for() loops and then see that everyone else solved it in one line
Kaz Baig
@kbaig
Nov 20 2017 20:59
@thekholm80 ah okay it works the same then. I'm one of those people that started to learn React and instantly decided to forsake for loops from that point on lol
Kyle Holm
@thekholm80
Nov 20 2017 20:59
learning React was what took me from total noob to kind of almost intermediate JS skills lol
Kaz Baig
@kbaig
Nov 20 2017 21:00
I'd say same
I only started programming for real this year so
Kyle Holm
@thekholm80
Nov 20 2017 21:00
me too! in February
Kaz Baig
@kbaig
Nov 20 2017 21:01
jan here
took a break (besides watching DevTips, the youtube channel) from feb to june though
Needed to focus on getting a job before graduating :)
Kyle Holm
@thekholm80
Nov 20 2017 21:05
Are you in the US? I think I remember you saying you've lived all over but I don't recall where you're currently located. Somewhere french-speaking?
Kaz Baig
@kbaig
Nov 20 2017 21:06
Nah I'm in Illinois atm, moved here from Boston a few months ago for work
Kyle Holm
@thekholm80
Nov 20 2017 21:06
oh geez who the heck am I thinking of? lol
Kaz Baig
@kbaig
Nov 20 2017 21:06
I am the one who said they've kinda lived all over tho you're right
Kaz Baig
@kbaig
Nov 20 2017 21:16
@thekholm80 oh yeah there was once that I wrote a phrase in french lol
Kyle Holm
@thekholm80
Nov 20 2017 21:17
my memory is horrible, i'm surprised i know my own name most days
Kaz Baig
@kbaig
Nov 20 2017 21:17
heh
Joshua Arnett
@josha5
Nov 20 2017 22:07
@thekholm80 codewars is awesome I try to solve at least 1 kata per day
@thekholm80 do you solve any of the 4kyu questions and below? I feel like at that point they don't get any harder but just much longer. I only do 5kyu and up questions haha
Kyle Holm
@thekholm80
Nov 20 2017 22:14
@josha5 i'm not sure if i've done any 4 kyu or lower, it's been a while since i've really done any katas
once in a while a friend will send me one to try, but i don't really do codewars much beyond that anymore
Travis Boss
@travisboss
Nov 20 2017 22:35
the speedrunchallenge is a lot of fun for css if anyone is in to that, I try to do one or two a day on codepen.
Henry
@GitHub-Henry
Nov 20 2017 22:49
@travisboss the link looks like a good way to up one's CSS game, thank's for sharing, :shipit: :dizzy:
CamperBot
@camperbot
Nov 20 2017 22:49
github-henry sends brownie points to @travisboss :sparkles: :thumbsup: :sparkles:
:cookie: 302 | @travisboss |http://www.freecodecamp.org/travisboss
Daniel
@dkapexhiu
Nov 20 2017 23:08
Hi! in this code can it console.log only once and not per all the elements in the array?
function linearSearch(array, x){ for (var i=0; i<array.length; i++){ if(array[i] === x){ console.log(i); break; } console.log('Not found'); } }
Albert Cardona II
@daddycardona
Nov 20 2017 23:09
hello again all of you great people :) so I got my spreadsheet to do what I wanted to thanks to @kbaig and I finally made my video. I forgot so much on how to use excel because well I have not needed it like i use too LOL
CamperBot
@camperbot
Nov 20 2017 23:09
daddycardona sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 443 | @kbaig |http://www.freecodecamp.org/kbaig
Albert Cardona II
@daddycardona
Nov 20 2017 23:10
because that means array[i] don't === x
@dkapexhiu
Daniel
@dkapexhiu
Nov 20 2017 23:17
how can i solve to print once? @daddycardona
Albert Cardona II
@daddycardona
Nov 20 2017 23:17
`function linearSearch(array, x){
    for (var i=0; i<array.length; i++){
        if(array[i] === x){
            console.log(i);
            break;
        }
        console.log('Not found');
    }
}`
if you want cosole to log then you need to take out the if statement or if you want it to log everytime array[i] ===x then you need to take out break ; statement
break; basically stops the loop
At my brother from another mother and father @dkapexhiu
lol
Daniel
@dkapexhiu
Nov 20 2017 23:23
it continues to log for every element in the array..
hahahahaha thank you very much brother :smile:
Albert Cardona II
@daddycardona
Nov 20 2017 23:26
I am sorry I wrote that wrong you should just take out the break ; and add the second console log after the loop @dkapexhiu
can you put all your code in?
Daniel
@dkapexhiu
Nov 20 2017 23:31
function linearSearch(array, x){ for (var i=0; i<array.length; i++){ if(array[i] === x){ console.log(i); } } console.log('Not found'); } linearSearch([2, 3, 4, 5, 6, 7, 8, 9], 4);
i removed the break and added "Not found " at the end.. but now it consoles the element found and the message
Albert Cardona II
@daddycardona
Nov 20 2017 23:37
`function linearSearch(array, x){
    for (var i=0; i<array.length; i++){
        if(array[i] === x){
            console.log(i);
        }
    }
    console.log('Not found');
}
linearSearch([2, 3, 4, 5, 6, 7, 8, 9], 4);`
so your goal is to find the second argument x
you can write an if statement but let me try to remember what I am doing for this
what is the name of that challenge @dkapexhiu
Daniel
@dkapexhiu
Nov 20 2017 23:45
it linear search algorithm .. i was trying to do some algorithms in javascript..
Moisés Man
@moigithub
Nov 20 2017 23:46
code runs from top to bottom.. soo after loops ends next is c2nd console.log
Daniel
@dkapexhiu
Nov 20 2017 23:47
yes, you are right @moigithub i get it
function linearSearch(array, x){ for (var i=0; i<array.length; i++){ if(array[i] === x){ console.log(i); } } }
if i do this, it consoles only the position of the searched item in the array.. but if it doesnt find it?
Moisés Man
@moigithub
Nov 20 2017 23:50
u could use an extra variable
Albert Cardona II
@daddycardona
Nov 20 2017 23:50
i was just thinking about that @moigithub
Moisés Man
@moigithub
Nov 20 2017 23:52
msg='no foun'
loop {
   if  found { 
      msg=i
      bkeak
    }
}
console.log(msg
Daniel
@dkapexhiu
Nov 20 2017 23:54
yes, maybe but it consoles the same thing.. the position and in the end the message
Albert Cardona II
@daddycardona
Nov 20 2017 23:54
I was about to say something like that but I am on the phone and you are way smarter than i lol
Daniel
@dkapexhiu
Nov 20 2017 23:54
thanks both @moigithub and @daddycardona
CamperBot
@camperbot
Nov 20 2017 23:54
dkapexhiu sends brownie points to @moigithub and @daddycardona :sparkles: :thumbsup: :sparkles:
:cookie: 492 | @daddycardona |http://www.freecodecamp.org/daddycardona
:star2: 3715 | @moigithub |http://www.freecodecamp.org/moigithub
Albert Cardona II
@daddycardona
Nov 20 2017 23:56
@dkapexhiu pay attention to his code he basically says msg="not Found" then in the loop he says
if (found) { msg = i; // meaning it is found and this is what you want to do then after that
break; }
Daniel
@dkapexhiu
Nov 20 2017 23:58
yes, now it functions good.. thanks again @daddycardona
CamperBot
@camperbot
Nov 20 2017 23:58
dkapexhiu sends brownie points to @daddycardona :sparkles: :thumbsup: :sparkles:
api offline
Albert Cardona II
@daddycardona
Nov 20 2017 23:59
thanks @moigithub you the man for the suggestion :)
CamperBot
@camperbot
Nov 20 2017 23:59
:star2: 3716 | @moigithub |http://www.freecodecamp.org/moigithub