These are chat archives for FreeCodeCamp/HelpFrontEnd

24th
Jan 2018
Dan Lafferty
@DanLaff
Jan 24 2018 00:01
@RandyGoldsmith Flexbox + CSS Grid
Ghost
@ghost~580ed9c0d73408ce4f309ef0
Jan 24 2018 02:24
This message was deleted
aRtoo
@artoodeeto
Jan 24 2018 02:25
hey fam! anyone done with there simon game? i cant get the logic right on turns heres my pen:https://codepen.io/artoo/pen/opQZWy
shivam gupta
@shivamg11000
Jan 24 2018 03:08
Cannot read property 'drop' of undefined ?
https://codepen.io/shivamg11000/pen/NXmwpb?editors=0010
why so
Marc
@MWBauer
Jan 24 2018 03:22
So i'm so out of practice that i can't build a for loop.
yes, folks, I've returned to stupid
Other than that, how's everyone?
Tom
@moT01
Jan 24 2018 03:25
im here
Marc
@MWBauer
Jan 24 2018 03:27
That's a.....good thing, right?
Tom
@moT01
Jan 24 2018 03:27
yup
Marc
@MWBauer
Jan 24 2018 03:28
Ok. Good
Wanna' help me build this?
Tom
@moT01
Jan 24 2018 03:28
whatcha building
Marc
@MWBauer
Jan 24 2018 03:28
var a2aArr = aArr.filter(function(val) {
  for (var i = 0; i <= arr1.length; i++) {
    if (aArr[] !== bArr[])
       diffArr.push();
  }
Tom
@moT01
Jan 24 2018 03:30
and
what is it
i see 6 different arrays there
you sure you need all those
kalzimonium
@kalzimonium
Jan 24 2018 03:31
help please. it is either a bug in the lesson or i am doing something wrong
Marc
@MWBauer
Jan 24 2018 03:31
IT's a for loop. I'm trying to filter thru one and compare to the second and make a new arr out of the differences.
Kal, it's a bug.
hwat's going on?
kalzimonium
@kalzimonium
Jan 24 2018 03:31
Make Unique Objects by Passing Parameters to our Constructor
Marc
@MWBauer
Jan 24 2018 03:31
So what code do you have so far?
kalzimonium
@kalzimonium
Jan 24 2018 03:31
this one. no matter what i do it doesn't take it

this is the solution that i have and it doesn't let me pass var Car = function() {
//Change this constructor
this.wheels = wheels;
this.seats = seats;
this.engines = engines;
};

//Try it out here
var myCar = new Car(1,2,3);

original code is this : var Car = function() {
//Change this constructor
this.wheels = 4;
this.seats = 5;
this.engines = 1;
};

//Try it out here
var myCar;

Ken Haduch
@khaduch
Jan 24 2018 03:33
@kalzimonium - you have to name the function argument, for example, you are using this.wheels = wheels; but there has to be a parameter in the function arguments named wheels. Also seats and engines.
kalzimonium
@kalzimonium
Jan 24 2018 03:34
like the first one i put in here?
@khaduch like this? this.wheels = wheels;
this.seats = seats;
this.engines = engines;
};
Marc
@MWBauer
Jan 24 2018 03:34
In your var Car you need a function that calls those labels
kalzimonium
@kalzimonium
Jan 24 2018 03:36
@MWBauer i dont get it
Ken Haduch
@khaduch
Jan 24 2018 03:36
@kalzimonium - it would have to be declared in the function parameters as function(wheels, etc.) (the "etc." has to name the other function arguments, so that they are associated with the values that you pass when you invoke the function, and the order has to match what your parameter values represent.)
The example in the explanation shows pretty clearly what it should look like.
Marc
@MWBauer
Jan 24 2018 03:38
agreed.
kalzimonium
@kalzimonium
Jan 24 2018 03:39

@khaduch function newCar (wheels, seats, engines){

}
and what would be the code block for that function?

Marc
@MWBauer
Jan 24 2018 03:40
You have labels, now build the constructor with this statements.
Same order.
brb
kalzimonium
@kalzimonium
Jan 24 2018 03:41
@MWBauer this whole "this" lesson is complicated for me. been killing me
Ken Haduch
@khaduch
Jan 24 2018 03:41
@kalzimonium - replace the numeric values that they have in the initial code with the corresponding parameter names. If you run the tests, you can see from the test cases that they pass in numeric values, and tell you the expected results, so you can see the correspondence between the numeric values, the function arguments that they are associated with, and how you store them within the this.wheels, etc. arguments. Again, study the example code and replicate the functionality that they are describing.
@kalzimonium - the this argument and how it is used is a little bit of a complex topic... It takes a while to understand it.
Brad
@bradtaniguchi
Jan 24 2018 03:43
@kalzimonium this is possibly the most confusing thing in javascript, not gonna lie. It's a reason why ES6 does a bunch of stuff to make it less confusing
kalzimonium
@kalzimonium
Jan 24 2018 03:44
@khaduch omg. now i see what you mean. it is kind of misleading that it doesnt even mention anything about the top function and it only says "change this constructor" underneath it.
@MWBauer thank you for your help
CamperBot
@camperbot
Jan 24 2018 03:47
kalzimonium sends brownie points to @mwbauer :sparkles: :thumbsup: :sparkles:
api offline
kalzimonium
@kalzimonium
Jan 24 2018 03:47
@khaduch thank you for your help. i really appreciate it
CamperBot
@camperbot
Jan 24 2018 03:47
kalzimonium sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3691 | @khaduch |http://www.freecodecamp.org/khaduch
Tom
@moT01
Jan 24 2018 03:49
@MWBauer came up with something that gets ya close
var arr1 = [1,2,3];
var arr2 = [2,3,4];

var newArr = arr1.filter((val) => {
  return arr2.indexOf(val) < 0;
});
Marc
@MWBauer
Jan 24 2018 03:49
yw buddy
Ken Haduch
@khaduch
Jan 24 2018 03:50
@kalzimonium - you're welcome
@kalzimonium - it might make a little more sense that in addition to "change this constructor", also to instruct "Change the function declaration". It's kind of implied that if you try to use a function argument that you have to define it, but I would say that because of the potential for being really confusing it would possibly be clearer to put some other helpful comments for guidance.
Dan Lafferty
@DanLaff
Jan 24 2018 04:14
@shivamg11000 It's an ASI issue - If you're a beginner, always use semicolons to prevent the issue from happening. If you are against using semicolons, be sure to study the ASI rules: http://es5.github.com/#x7.9
// logs "a", "b", "c", and "d"
["a","b"].forEach(letter => console.log(letter));
["c","d"].forEach(letter => console.log(letter));

// logs "e" and "f", but not "g" or "h" - can't read property "h" of undefined
["e","f"].forEach(letter => console.log(letter))
["g","h"].forEach(letter => console.log(letter))
Ken Haduch
@khaduch
Jan 24 2018 04:33
@shivamg11000 - ASI - automatic semicolon insertion - I read an interesting article that I found that tells a lot of the pitfalls. http://www.bradoncode.com/blog/2015/08/26/javascript-semi-colon-insertion/. His basic point is "don't rely on it, it's buggy!"
Marc
@MWBauer
Jan 24 2018 04:43
hey ya'll. brb
Marc
@MWBauer
Jan 24 2018 05:03
Ok. I'm back.
Anyone know of or wanna' help me make an app?
@khaduch you still here?
Is anyone here?
bv
@binduverma1
Jan 24 2018 05:10
Hello, I am trying to work o n challege- Random Quote generator- but i do not understand from where I should get the quotes?
Ken Haduch
@khaduch
Jan 24 2018 05:15
@MWBauer - hey there. I was just about to leave but I couldn't respond on my phone... what's up? I've got to sign off shortly.
@Binduverma1 - you can make an array of quotes and use a random selection to take one and display it. Probably better is to use a quote API like quotesondesign.com - http://quotesondesign.com/api-v4-0/ or find another suitable quote server that you can use as a source of quotes. You can start with the local array of quotes, get the styling and everything functioning, then update to use an API.
@Binduverma1 - google "quote server API" and you'll see a lot of choices that are out there. You can find one that you like or looks interesting and find out how to use it from the docs.
@MWBauer - I'm signing out and will be offline for most of the day tomorrow, driving back home. Catch up with you sometime down the line.
khaduch @khaduch - signing out for the night - happy coding!
bv
@binduverma1
Jan 24 2018 05:22
@MWBauer Thanks so much for your help !!
CamperBot
@camperbot
Jan 24 2018 05:22
binduverma1 sends brownie points to @mwbauer :sparkles: :thumbsup: :sparkles:
api offline
bv
@binduverma1
Jan 24 2018 05:23
@khaduch thanks I got the answer to my question.
CamperBot
@camperbot
Jan 24 2018 05:23
binduverma1 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3692 | @khaduch |http://www.freecodecamp.org/khaduch
Marc
@MWBauer
Jan 24 2018 05:24
sorry, ken. LeAVE. have a good night.
@Binduverma1 I used a site somewhere online.
I'm gonna' check out for tonight. Take care.
William Watts
@Braillon7
Jan 24 2018 09:30
Helloooo Campers!...help needed here: im getting some kind of syntax error with my "querySelecorAll." it's reading as if it's some kind of DOM manipulation error that's usually seen with a misplaced script tag..but im using codepen and codepen places that in order for us...im not sure what's going on but im sure its simple...keep in mind whoever views my pen to see my code it's an unfinished project and i have code commented out everywhere...but hopefully one of you guys can give me an aha moment....https://codepen.io/Braillon7/pen/WdmbyW
Markus Kiili
@Masd925
Jan 24 2018 09:33
@Braillon7 Maybe document.querySelector('.select-secreen'), not document.querySelector('select-secreen')
Because you seem to be targeting using a class.
help me with m form
anyone on
William Watts
@Braillon7
Jan 24 2018 09:48
@Masd925 yes I'm targeting all classes
@Masd925 I'll see if that was my simple mistake here shortly
Deepak Manjunath
@Deepak2322
Jan 24 2018 09:49
does anyone know how to get a list of months between two dates, i want an array of months ex: [‘jan’,‘feb’,‘march’]
Aditya
@ezioda004
Jan 24 2018 09:56
@Deepak2322 If you know the months in the given dates, then make an array accordingly?
Markus Kiili
@Masd925
Jan 24 2018 10:03
@Deepak2322 The Date object has methods like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString that allow options for controlling the output string. You might be able to get the months out in that format.
Another way is to write an array of month names yourself and use it.
Deepak Manjunath
@Deepak2322
Jan 24 2018 10:04
can i get it dynamically without hardcoding months in array ?
Markus Kiili
@Masd925
Jan 24 2018 10:05
@Deepak2322 Check the Date object and the method I posted.
Deepak Manjunath
@Deepak2322
Jan 24 2018 10:05
is their any method which takes startDate and endDate and returns and array of months ?
Markus Kiili
@Masd925
Jan 24 2018 10:06
@Deepak2322 No, but you might be able to get the month name in that format from the Date object and incrementing the month is easy.
William Watts
@Braillon7
Jan 24 2018 11:38
@Masd925 I spelled the word "screen" wrong and I did forget to put the "." in front of my class I was selecting so thank you for noticing that
CamperBot
@camperbot
Jan 24 2018 11:38
braillon7 sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4668 | @masd925 |http://www.freecodecamp.org/masd925
Fernando
@lestairon
Jan 24 2018 13:05
https://codepen.io/Lestairon/pen/NagONm?editors=0010
Guy, why am i not getting any data from the api? :c
Markus Kiili
@Masd925
Jan 24 2018 13:06
@lestairon Are you sure that jQuery is imported?
There are some errors on browser developer tools console.
Fernando
@lestairon
Jan 24 2018 13:08
@Masd925 right, Jquery wasn't imported
Mb
ty
@Masd925 Thanks, get a cookie
CamperBot
@camperbot
Jan 24 2018 13:11
lestairon sends brownie points to @masd925 :sparkles: :thumbsup: :sparkles:
:star2: 4669 | @masd925 |http://www.freecodecamp.org/masd925
Fernando
@lestairon
Jan 24 2018 13:11
wait, i though they were cookies instead of points
spyreo
@spyreo
Jan 24 2018 13:22
hey hi
can anyone help me with "Create a form element?"
Stephen James
@sjames1958gm
Jan 24 2018 13:23
@spyreo What is your issue?
@spyreo Is this from the beta site
spyreo
@spyreo
Jan 24 2018 13:29
No @sjames1958gm
And i figured it out
Stephen James
@sjames1958gm
Jan 24 2018 13:34
@spyreo :+1:
Ali Bulut
@ali27001
Jan 24 2018 13:36
I am having problems with vue js
Saboor Malik
@ProgrammingForFun01
Jan 24 2018 13:37
@lestairon Yeah, once you reach 1000+ you will have stars. Under 1000 = cookies.
Fernando
@lestairon
Jan 24 2018 13:38
Oh
When i said "get a cookie" it didn't sound like i was expecting
Saboor Malik
@ProgrammingForFun01
Jan 24 2018 13:39
Well stars won't be tasty
Ali Bulut
@ali27001
Jan 24 2018 13:47
I have 2 web pages and I'm adding data to localstronge. I also want to draw the data on this page
how to show array object
Exaland Concept
@exaland
Jan 24 2018 14:01
Hi everyone , i need an help for making an planning booking system same to this one https://www.albert-learning.com/planning.html
i see this project use html + js + php
have you some idea for made this booking schedular time slot availability ?
thanks for your help
Daniel Romero
@Ranacode
Jan 24 2018 14:10
You can check the code with the developers tools on your browser
By the way I think the heavyweight logic it's in the backend side about that calendar
Fernando
@lestairon
Jan 24 2018 14:13
On the Weather app, how can i pass the location data to the api?
Fernando
@lestairon
Jan 24 2018 14:19
I already have the latitude and the longitude, but i don't know how to request the api the weather with those variables
Long Nguyen
@longnt80
Jan 24 2018 14:25
@lestairon "https://fcc-weather-api.glitch.me/api/current?lon=" + lon + "&lat=" + lat"
Fernando
@lestairon
Jan 24 2018 14:32
@longnt80 Thanks man
CamperBot
@camperbot
Jan 24 2018 14:32
lestairon sends brownie points to @longnt80 :sparkles: :thumbsup: :sparkles:
:cookie: 678 | @longnt80 |http://www.freecodecamp.org/longnt80
Stephen James
@sjames1958gm
Jan 24 2018 14:33
@lestairon Or with template strings (my new go-to) less quotes to worry about
`https://fcc-weather-api.glitch.me/api/current?lon=${lon}&lat=${lat}`
Fernando
@lestairon
Jan 24 2018 14:34
A guy on irc told me that this works too ?lat=#{lat}&lon=#{lon}
haven't tried yet
Stephen James
@sjames1958gm
Jan 24 2018 14:40
@lestairon For javascript? not that I am aware of.
Kirk Clemons
@kcclemo
Jan 24 2018 14:53
blob
I'm looking for help creating this type of effect on click
current state:
blob
Liam Docherty
@ldocherty1
Jan 24 2018 15:25
<header class="masthead text-center text-white d-flex" id="home">
    <div class="container my-auto">
      <div class="row bounceInDown animated">
        <div class="col-lg-10 mx-auto">
          <h2 class="maintxt">
              <strong>Hi, my name is Liam Docherty</strong>
            </h1>
          </div>
          <div class="col-lg-8 mx-auto">
            <p class="text-white mb-5">I am a Front End & Wordpress Developer based in the UK. If you are a business seeking a web presence or an employer looking to hire, you can get in touch with me <a href=#contact class="txtlink js-scroll-trigger" target=_blank>here</a>.</p>
            <a class="btn btn-primary btn-xl js-scroll-trigger" href="#services">Find Out More <i class="fa fa-chevron-down" aria-hidden="true"></i></a>
          </div>
        </div>
      </div>
    </header>
header.masthead {
  padding-top: 10rem;
  padding-bottom: calc(10rem - 56px);
  background-image: url(../img/header.jpg);
  background-position: center center;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
/* HOME */

@media (max-width: 575px) {
  .home1{
    background-color: #111;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .home1{
    background-color: #111;
}

@media (min-width: 768px) and (max-width: 991px) {
  .home1{
    background-color: #111;

}
Hi, as you can see in my CSS I have assigned an image to be the background of one of my main sections on my website. However, what class name do I put in the CSS media query to make the media query function?
I'm trying to change home1 to the correct class to where I can change the background appearance depending on the users screen display size
Tom
@moT01
Jan 24 2018 15:43
i dont see a .home1 in the html
SAURABH SHEORAIN
@SSheorain
Jan 24 2018 17:13
can anyone suggest a cool animation for alertify.js for messages
Dimitris Nik.
@dimitrissnk
Jan 24 2018 17:13
Hello there, if I want to get every font on my page to work on every device I have to use @font-face, am I right?
Deepak Manjunath
@Deepak2322
Jan 24 2018 17:20
how to split "201709" into ['2017','09']
What can i do if i want it to change ºC with ºF?
@Deepak2322 Maybe taking the first 4 digits and making then the year, then take the last 2 digits and make them month, i think that should work
Kaz Baig
@kbaig
Jan 24 2018 18:01
@Deepak2322 could just use String.slice
Stephen James
@sjames1958gm
Jan 24 2018 18:02
@lestairon
If you set variable units to match "C" or "F"
$("$cof").text(units)
Adel
@AdelMahjoub
Jan 24 2018 18:05
@Deepak2322 group 1 is the first 4 digits group 2 is the last 2 digits
const regex = /([0-9]{4})([0-9]{2})/g;
    const str = `201709`;
    let m;

    while ((m = regex.exec(str)) !== null) {
        // This is necessary to avoid infinite loops with zero-width matches
        if (m.index === regex.lastIndex) {
            regex.lastIndex++;
        }

        // The result can be accessed through the `m`-variable.
        m.forEach((match, groupIndex) => {
            console.log(`Found match, group ${groupIndex}: ${match}`);
        });
    }
Liam Docherty
@ldocherty1
Jan 24 2018 18:10
@moT01 Yes exactly I was just messing around with that. I removed it. My point is that I'm not sure what to put there and if someone could tell me it would be very appreciated.
Please can someone scroll up and help me with my post if anyone is free?
Fernando
@lestairon
Jan 24 2018 18:26
@sjames1958gm Like, how...?
Stephen James
@sjames1958gm
Jan 24 2018 18:27
@lestairon I think I misunderstood your question.
you mean change the units, not just the C <> F
Fernando
@lestairon
Jan 24 2018 18:27
Yeah
Stephen James
@sjames1958gm
Jan 24 2018 18:28
@lestairon You can add a click handler to #cof and in there recalculate the temp and replace in the DOM.
You will need to put temperature value where it can be accessed by another click handler
Fernando
@lestairon
Jan 24 2018 18:38

@sjames1958gm

$("#cof").on("click", function () {
            $("temp").html(data.main.temp * 9 / 5 + 32);

Shouldn't this work?

Stephen James
@sjames1958gm
Jan 24 2018 18:40
@lestairon #temp
@lestairon Of course you'd probably want it to toggle. This only goes one way
Fernando
@lestairon
Jan 24 2018 18:42
Yeah, i was thinking about that, but i still wanted to try
But is not even working 1 way
And #temp is the id of the element that i want to change
Stephen James
@sjames1958gm
Jan 24 2018 18:53
@lestairon But you have "temp" not "#temp" in the code above
Fernando
@lestairon
Jan 24 2018 18:54
Oh, true
stupid mistakes, lol
@sjames1958gm Thanks man, haha
CamperBot
@camperbot
Jan 24 2018 18:56
lestairon sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8893 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
Fernando
@lestairon
Jan 24 2018 18:57
I wonder how many time will that happen
Nate Mallison
@NJM8
Jan 24 2018 19:09
@lestairon forever. :smile:
Stephen James
@sjames1958gm
Jan 24 2018 19:13
@lestairon :+1:
well I am into my 38th year of programming and it still happens
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 19:24
Gday my good people
Pieter Stokkink
@forkerino
Jan 24 2018 19:25
@sjames1958gm Congrats on passing 8888 points, I missed it!
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 19:26
What're you guys up to
Stephen James
@sjames1958gm
Jan 24 2018 19:27
@forkerino :)
@forkerino Thanks
CamperBot
@camperbot
Jan 24 2018 19:27
sjames1958gm sends brownie points to @forkerino :sparkles: :thumbsup: :sparkles:
:star2: 2974 | @forkerino |http://www.freecodecamp.org/forkerino
Fernando
@lestairon
Jan 24 2018 19:34
Woah
38 years programming
That's amazing
Kaz Baig
@kbaig
Jan 24 2018 19:45
Most people here haven't even been breathing for 38 years, let alone programming
@sjames1958gm must be better at programming than we are at breathing then ;)
Fernando
@lestairon
Jan 24 2018 19:46
Yeah haha
Stephen James
@sjames1958gm
Jan 24 2018 19:47
@kbaig Nice :)
Fernando
@lestairon
Jan 24 2018 19:48
You've been programming like my whole age times 2
Plus 4
Kaz Baig
@kbaig
Jan 24 2018 19:53
@ICodedGod Still trying to build this reporting system in Wolfram Language
caused a heated argument amongst our devs lol
Stephen James
@sjames1958gm
Jan 24 2018 20:00
@lestairon lol
Jorge
@OrangeKulture
Jan 24 2018 20:18
whats happening fellow campers :D
how come you can no longer see the solutions to all of your submitted algos
Kaz Baig
@kbaig
Jan 24 2018 20:26

@OrangeKulture If you go to your profile, you will find the explanation

Note: We have temporarily disabled viewing and sharing solutions, however they are safely stored in your profile. You can learn more about this here.

Jorge
@OrangeKulture
Jan 24 2018 20:28
ahh shit, sry hehe .. noticed that after I asked
@kbaig thanks a lot !
CamperBot
@camperbot
Jan 24 2018 20:28
orangekulture sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 551 | @kbaig |http://www.freecodecamp.org/kbaig
Jorge
@OrangeKulture
Jan 24 2018 20:28
brownies are back ??? niceee !
Kaz Baig
@kbaig
Jan 24 2018 20:35
When did they leave?
@OrangeKulture
Fernando
@lestairon
Jan 24 2018 20:38
$("#cof").on("click", function (T) {
            T.toggle($("#temp").html((data.main.temp * 1.8) + 32), function(X) {
              $("#temp").html(data.main.temp);
            });
          });
Idk how to make it go back to ºC
Jorge
@OrangeKulture
Jan 24 2018 20:47
@kbaig a while ago... havent been on in ages, used to be in here all the time
Tom
@moT01
Jan 24 2018 20:48
@ldocherty1 did you get it figured out?
@media (max-width: 700px) {
  #home{
    color: red; }
}
that would change the color of id="home" when screen < 700px wide
@OrangeKulture the brownies seemed intermittent - they were still given out - but camperbot was being stingy
Nate Mallison
@NJM8
Jan 24 2018 20:55
@lestairon I would set a variable to either "f" or "c" and then have the button click check the status of that variable. If 'f' convert temp to c and update html, if 'c' convert to f and update html.
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:07
Hey lads
I'm in quite a desperate need of a whizkid
Tom
@moT01
Jan 24 2018 22:08
whats the problem
Tiago Correia
@tiagocorreiaalmeida
Jan 24 2018 22:08
we all here :D just ask
Tom
@moT01
Jan 24 2018 22:08
that's not me - but i might be able to help
Casper Beyer
@caspervonb
Jan 24 2018 22:08
Ask instead of asking to ask ;)
Kaz Baig
@kbaig
Jan 24 2018 22:09
^^^^^^^^^^^^^^^^^^^^^^^^^
Casper Beyer
@caspervonb
Jan 24 2018 22:10
Everyone's always multitasking, it's like that one team member on slack going "hey u there?", "hey u there?" all day :P
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:12
haha
Kaz Baig
@kbaig
Jan 24 2018 22:12
Being here is a 'keep web skills sharp in case you need it' activity at work. I could tell you I'm here and then go afk right before you ask the question
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:12
I'll get to my problem in a second, it's giving me eternal pain in the face
I have a script that isn't working
at all
Casper Beyer
@caspervonb
Jan 24 2018 22:18
Did you try turning it on and off again?
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:18
Yes, I even checked if it's plugged in...
Power on and everything
Here is what it's supposed to do:
When a user on the website selects a language, the property listings on that site should be displayed in the currency attached to that.
In stead, it does fuck all
Casper Beyer
@caspervonb
Jan 24 2018 22:19
My mindreader 3000 seems to hit a firewall or something, source ;)
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:19

if(isset($_POST['get_option'])){
$_SESSION["price"] = $_POST['get_option'];
$to_Curr =$_POST['get_option'];
}elseif(isset($_POST['select_lang'])){
$select_lang = $_POST['select_lang'];
switch ($select_lang) {
case 'Norsk':
/'Norsk bokmål' || /
$to_Curr = 'NOK';
$_SESSION["current_lang"] = 'nb';
break;
case 'Español':
$to_Curr = 'EUR';
$_SESSION["current_lang"] = 'es';
break;
case 'Svenska':
$to_Curr = 'SEK';
$_SESSION["current_lang"] = 'sv';
break;
case 'English':
$to_Curr = 'GBP';
$_SESSION["current_lang"] = 'en';
break;

default:
$to_Curr = 'NOK';
$_SESSION["current_lang"] = '';
break;
}
//echo $to_Curr;
$_SESSION["price"] = $to_Curr;
//print_r($_SESSION);
}

Kaz Baig
@kbaig
Jan 24 2018 22:20
uhhh thats hard to read
Casper Beyer
@caspervonb
Jan 24 2018 22:20
triple ticks for code blocks, markdown style
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:20
and now, as you are about to give the answer, I will see the problem
yea it's AJAX
Kaz Baig
@kbaig
Jan 24 2018 22:20
You mean PHP?
Tom
@moT01
Jan 24 2018 22:21
you need to go edit that so people can read it -- three ticks (`) then new line (shift+enter) then code then new line and then three ticks again
Kaz Baig
@kbaig
Jan 24 2018 22:21
Well if that's PHP, should prob try the back end room
Unless someone happens to know it here
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:22
if(isset($_POST['get_option'])){
$_SESSION["price"] = $_POST['get_option'];
$to_Curr =$_POST['get_option'];
}elseif(isset($_POST['select_lang'])){
$select_lang = $_POST['select_lang'];
switch ($select_lang) {
case 'Norsk':
/*'Norsk bokmål' || */
$to_Curr = 'NOK'; 
$_SESSION["current_lang"] = 'nb';
break;
case 'Español':
$to_Curr = 'EUR'; 
$_SESSION["current_lang"] = 'es';
break;
case 'Svenska':
$to_Curr = 'SEK'; 
$_SESSION["current_lang"] = 'sv';
break;
case 'English':
$to_Curr = 'GBP'; 
$_SESSION["current_lang"] = 'en';
break;

default:
$to_Curr = 'NOK';
$_SESSION["current_lang"] = '';
break;
}
//echo $to_Curr;
$_SESSION["price"] = $to_Curr;
//print_r($_SESSION);
}
sorry
Messed up there
haha
Bjorn van de Peut
@bjorno43
Jan 24 2018 22:22
'''
CamperBot
@camperbot
Jan 24 2018 22:22
:bulb: to format code use backticks! ``` more info
Bjorn van de Peut
@bjorno43
Jan 24 2018 22:24
So what's the question?
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:24
Well
Here is what it's supposed to do:
When a user on the website selects a language, the property listings on that site should be displayed in the currency attached to that.
Why doesn't it? :/
Casper Beyer
@caspervonb
Jan 24 2018 22:27
  1. You aren't sending anything back
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:27
Oh god.. there is more that 1
Casper Beyer
@caspervonb
Jan 24 2018 22:27
From what you've pasted anyway
Bjorn van de Peut
@bjorno43
Jan 24 2018 22:28
I have no idea. That code alone isn't enough to be able to answer that question. You're setting up some session variables. But you need to keep in mind that sessions can only be set before headers are sent to the browser. After that, you can change the sessions variables with an Ajax script all you want, but it won't actually update the headers
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:29
@bjorno43 You make a solid point
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:34
Ah! thou handsome individuals. I have the solution :smile:
Thanks for the efforts
Bjorn van de Peut
@bjorno43
Jan 24 2018 22:35
@ICodedGod I would also advise you to use empty() instead of isset(). Simply because isset only verifies if a variable exists. It doesn't care if the value is empty or null. Empty will verify if a variable exists and if there's data in it
Of course you'll have to use if(!empty() (if NOT empty). Otherwise it'll return false while it should return true, ghehe
supercalifragilisticthisbesuchacodekid
@ICodedGod
Jan 24 2018 22:37
Oh that's a good one
Christopher Barclay
@Clesoud
Jan 24 2018 23:06
Hey all, I'm having tons of trouble with the Seek and Destroy problem under Basic Algorithm Scripting. I don't understand how to use the arguments after the initial array, when you don't know how many arguments will be there. And I'm having a lot of frustrating trouble removing specific items from an array that are not either at the very end or at the very beginning. My code is a jumbled mess that I have rewritten 4 or 5 times and I know this problem can't be this long to solve.
Kaz Baig
@kbaig
Jan 24 2018 23:07
@Clesoud linking the problem and your code would help us help you :)
Christopher Barclay
@Clesoud
Jan 24 2018 23:07
@kbaig Hey Kaz! Thanks for the reply. Can you remind me how to link both of those?
CamperBot
@camperbot
Jan 24 2018 23:07
clesoud sends brownie points to @kbaig :sparkles: :thumbsup: :sparkles:
:cookie: 552 | @kbaig |http://www.freecodecamp.org/kbaig
Christopher Barclay
@Clesoud
Jan 24 2018 23:08
Copy/paste or was there a button combo to do it better?
Kaz Baig
@kbaig
Jan 24 2018 23:08
@Clesoud the url of the problem, and copy-paste your code with three backticks (`) in the lines before and after your code
Christopher Barclay
@Clesoud
Jan 24 2018 23:08
// Remove all the values

function destroyer(arr) {
  // create filter list filterMe and fill it with all elements in arr except arr[0]
  var filterMe = [];

  for (var z = 1; z<arr.length; z++) {
    filterMe.push(arr[z]);
  }


  // create a list of numbers which represent the indexes of arr elements to filter
  var filterIndex = [];

  // for loop through arr[0]
  for (var y = 0; y<arr[0].length; y++) {
    // for loop through filterMe 
    for (var x = 0; x<filterMe.length; x++) {
      // if arr[0][y] === filterMe[x]
      if (arr[0][y]===filterMe[x]) {
        // push the index 'x' to filterIndex
        filterIndex.push(x);   // will contain list of all indexes to splice.
      }
    }
  }


  // new array to hold elements not cut from old arr[0]
  var newArray = [];
  // keep track of how many indexes have been cut with 'count'
  var count = 0;

  // iterate through filterIndex 
  for (var q=0; q<filterIndex.length; q++) {
    // for loop through arr[0] again to find values not to cut
    for (var r=0; r<arr[0].length; r++) {
      // if filterIndex[q]===r then skip that number
      if (filterIndex[q]===r) {  // keep track of which filterIndex we're at with 'q'
        // skip and add 1 to 'count'
        count++;
      } else {
        newArray.push(arr[0][r-count]);  // will only pick up the arr[0] elements not skipped
      }
    }
  }

  return newArray;
}


//test:
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
OK lol wow that's huge
@kbaig Kaz?
Ian
@Naiguy1
Jan 24 2018 23:29
@krisb1220 I looked through all of them and nothing I try works.
Kevin Galang
@kgalang
Jan 24 2018 23:50
To those familiar with react, could you please help me figure out if I am doing anything wrong in this react challenge on the beta site?
Here is the link to the challenge: https://beta.freecodecamp.org/en/challenges/react/use-arraymap-to-dynamically-render-elements
Here is my current code:
const textAreaStyles = {
  width: 235,
  margin: 5
};

class MyToDoList extends React.Component {
  constructor(props) {
    super(props);
    // change code below this line
    this.state = {
      userInput: '',
      toDoList: []
    };
    // change code above this line
    this.handleSubmit = this.handleSubmit.bind(this);
    this.handleChange = this.handleChange.bind(this);
  }
  handleSubmit() {
    const itemsArray = this.state.userInput.split(',');
    this.setState({
      toDoList: itemsArray
    });
  }
  handleChange(e) {
    this.setState({
      userInput: e.target.value
    });
  }
  render() {
    const items = this.state.toDoList.map((x) => {
      return <li> {x} </li>;
    });
    return (
      <div>
        <textarea
          onChange={this.handleChange}
          value={this.state.userInput}
          style={textAreaStyles}
          placeholder="Separate Items With Commas" /><br />
        <button onClick={this.handleSubmit}>Create List</button>
        <h1>My "To Do" List:</h1>
        <ul>
          {items}
        </ul>
      </div>
    );
  }
};

The test that I am failing says:

"When the Create List button is clicked, the MyToDoList component should dynamically return an unordered list that contains a list item element for every item of a comma-separated list entered into the textarea element. };"

Ian
@Naiguy1
Jan 24 2018 23:53
Guys I have been working on this code and It won't work. could you help me. (Im a noob)
function factorialize(num) {
return num;
}
var factorialize = 1 2 3 4 5 == num;
var factorialize(5);
Kevin Galang
@kgalang
Jan 24 2018 23:55
@Naiguy1 I can try to help. Are you working on a challenge? Send the link if you are
Kaz Baig
@kbaig
Jan 24 2018 23:55
@kgalang he wants to return num!
Kevin Galang
@kgalang
Jan 24 2018 23:55
I need more context to help you out
@kgalang Im working on a challenge
Kaz Baig
@kbaig
Jan 24 2018 23:57
@Naiguy1 You have to only change code inside the function
Try using a for loop
Ian
@Naiguy1
Jan 24 2018 23:57
@Naiguy1 You have to only change code inside the function
what does that mean
oh, for loop
Kaz Baig
@kbaig
Jan 24 2018 23:58
function factorialize(num) {
  // in here
}

// not here
Ian
@Naiguy1
Jan 24 2018 23:58
ok oll try that
Kevin Galang
@kgalang
Jan 24 2018 23:59
Only leave the default code outside of the function