These are chat archives for FreeCodeCamp/Help

3rd
May 2018
mstellaluna
@mstellaluna
May 03 2018 00:12
Lol ok
mstellaluna
@mstellaluna
May 03 2018 00:27
@thekholm80 @ndburrus if more than one of his commands fail again (test with commands like rooms or eightball or commands or thank someone), let me know i'll advise who fixed him :)
Kyle Holm
@thekholm80
May 03 2018 00:28
@mstellaluna will do
Norvin Burrus
@ndburrus
May 03 2018 00:28
@mstellaluna ok, wll do... thanks for looking into the issue :smile:
CamperBot
@camperbot
May 03 2018 00:28
ndburrus sends brownie points to @mstellaluna :sparkles: :thumbsup: :sparkles:
:cookie: 648 | @mstellaluna |http://www.freecodecamp.org/mstellaluna
Ken Haduch
@khaduch
May 03 2018 02:43
@mstellaluna - thanks for pursuing that
CamperBot
@camperbot
May 03 2018 02:43
khaduch sends brownie points to @mstellaluna :sparkles: :thumbsup: :sparkles:
:cookie: 649 | @mstellaluna |http://www.freecodecamp.org/mstellaluna
mstellaluna
@mstellaluna
May 03 2018 02:45
@khaduch anytime :)
Kyle Holm
@thekholm80
May 03 2018 03:18
@khaduch :wave:
Ken Haduch
@khaduch
May 03 2018 03:23
@thekholm80 - hello!
xlayal
@xlayal
May 03 2018 04:11
把你的文本输入元素嵌套进一个form元素。
How to do it?
Claudio Restifo
@Marmiz
May 03 2018 04:24

Guys I'm brainfarting hard:
how do I access a variable starting from a string variable?

imagine:

oneObject = {};
twoObject = {};
threeObject = {};

function logObj(which) {
  // I want to log the corresponding object
}

logObj("one") // I want to access oneObject
logObj("two") // I want to access twoObject

Don't ask me why I want to do that, since now I want to do that

Greg D
@mosaic-greg
May 03 2018 04:27
function logObj(which) {
return which;
}
no wait that won't work
Claudio Restifo
@Marmiz
May 03 2018 04:35
no since should be variable called which+"Object"
I swear there should be a way without using eval or some other shenangans
Missli
@LHZ1997
May 03 2018 05:48
你的a元素应该使用"cat photos"作为其anchor text(锚点文本)。
这个我该怎么做呢
他说的是把链接到图片上啊
Vivek Ranjan
@vivekranjan92
May 03 2018 06:04
Hi I need a help..!!! Can anyone help me here?
Challenge name is "Generate Random Whole Numbers within a Range"

Below is my code and the 2nd test case is not passing

function ourFunction(ourMin, ourMax) {

return Math.floor(Math.random() * (ourMax - ourMin + 1)) + ourMin;
}

ourFunction(1, 9);

// Only change code below this line.

function randomRange(myMin, myMax) {

return (Math.floor(Math.random() * (myMax - myMin)) + myMin); // Change this line

}

// Change these values to test your function
var myRandom = randomRange(5, 15);

Anyone on here?
Aditya
@ezioda004
May 03 2018 06:12
@vivekranjan92 randomRange() is 1 off, example say you do randomRange(2, 5), the range will be [2, 4]
Vivek Ranjan
@vivekranjan92
May 03 2018 06:14
But according to the formula i have tried to debug it and I am getting correct output... If we are caliing randomRange(2, 5) then as per formula return (Math.floor(Math.random() * (myMax - myMin)) + myMin); it should return (5-2)+2, Which is equal to 5.
@ezioda004
Aditya
@ezioda004
May 03 2018 06:18
Math.random() will give range b/w [0, 1), myMax - myMin is 3 in this case, now you have range of [0, 3), then you do Math.floor() which makes the range [0, 2] and finally you add myMin which is 2 so the range is [2, 4]
Try invoking randomRange(2, 5) multiple times, you wont get 5
Vivek Ranjan
@vivekranjan92
May 03 2018 06:22
yes I will check it
thanks
Aditya
@ezioda004
May 03 2018 06:23
Also, the last myMin is outside Math.floor() which is why (5-2)+2 doesnt happen. Math.floor() rounds up the number and after that you add myMin
Vivek Ranjan
@vivekranjan92
May 03 2018 06:24
So should I add one extra paranthesis?
@ezioda004
Aditya
@ezioda004
May 03 2018 06:28
@vivekranjan92 You can simply add 1 to the myMax - myMin which will effectively make the range [0, myMax-myMin + 1) and when Math.floor() rounds you will have [0, myMax - myMin]
Vivek Ranjan
@vivekranjan92
May 03 2018 06:29
Thanks for helping me out. But I have tried that as well and then the 1st tes case is failing
@ezioda004
Aditya
@ezioda004
May 03 2018 06:29
Can you show your updated code?
Vivek Ranjan
@vivekranjan92
May 03 2018 06:29
Sure

function randomRange(myMin, myMax) {

return (Math.floor(Math.random() * (myMax - myMin)) + myMin)+1;
}

Aditya
@ezioda004
May 03 2018 06:30
I meant 1 inside Math.floor() so something like (Math.random() * (myMax - myMin + 1))
Vivek Ranjan
@vivekranjan92
May 03 2018 06:31
ok let me check that as well
Yes thanks it is working now.. One more help... can you please explain me what we have done?? what was the difference between my code the the suggestion that you provided
@ezioda004
Aditya
@ezioda004
May 03 2018 06:37
This is your old code (Math.floor(Math.random() * (myMax - myMin)) + myMin);. First, Math.random() is executed, so you have range of [0, 1) 0 is inclusive, 1 is exclusive. Now you multiply myMax - myMin to [0, 1) so the range (assuming myMax to be 5 and myMin to be 2) becomes [0, 3), here again 0 is inclusive and 3 is exclusive. Now Math.floor() executes which rounds decimals to number less. So the range now becomes [0, 2], both are inclusive and finally you add myMin so the range effectively becomes [2, 4]
In mathematics, usually parentheses ( ) are used to show exclusive number and [ ] is used to show inclusive numbers, thats why I used them like that.
Now, in the new code that ie (Math.floor(Math.random() * (myMax - myMin + 1)) + myMin) all the steps are same except in the intermediate step the range becomes [0, 4) and when Math.floor() is executed you get [0, 3] and finally you add myMin which makes the range [2, 5]
Vivek Ranjan
@vivekranjan92
May 03 2018 06:42
@ezioda004 Give me some time please
Aditya
@ezioda004
May 03 2018 06:43
Yes, sure take your time. Ask questions if needed, or you can just remember this formula but it helps remembering if you understand whats happening :)
I'd also correct myself, first the innermost ( ) is resolved in any expression so (myMax - myMin + 1) is resolved first and after that Math.random() * result is resolved.
Vivek Ranjan
@vivekranjan92
May 03 2018 06:47
@ezioda004 great.. thanks a ton :)
CamperBot
@camperbot
May 03 2018 06:47
:cookie: 545 | @ezioda004 |http://www.freecodecamp.org/ezioda004
vivekranjan92 sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
Aditya
@ezioda004
May 03 2018 06:48
@vivekranjan92 Hopefully you understood, it can seem a bit tricky honestly and no problem.
Vivek Ranjan
@vivekranjan92
May 03 2018 06:48
yes i understood the concept :) :+1: :clap:
Aditya
@ezioda004
May 03 2018 06:49
:sparkles:
zhang874010534
@zhang874010534
May 03 2018 09:21
Aimée
@Aimee-MacDonald
May 03 2018 09:34
Hah! I guess this is where everybody went? Hi everyone!
Claudio Restifo
@Marmiz
May 03 2018 09:39
dang! we've been found!
@Aimee-MacDonald :wave:
Aimée
@Aimee-MacDonald
May 03 2018 10:13
lol, hope you're doing well
Bhanu Pratap Singh
@bhanubais
May 03 2018 12:26
Anyone know? when beta version of freecodecamp will be live?
Ken Haduch
@khaduch
May 03 2018 12:40
@Aimee-MacDonald - hello to you and everyone here
Norvin Burrus
@ndburrus
May 03 2018 12:51
@khaduch hi :wave: ...good day to you...
Ken Haduch
@khaduch
May 03 2018 12:52
@ndburrus - and to you, too!
Vivek Ranjan
@vivekranjan92
May 03 2018 12:53
any one know anything about amazon fire tv stick???
Vivek Ranjan
@vivekranjan92
May 03 2018 13:07
@ndburrus Thanks for the response and the link which you have provided
CamperBot
@camperbot
May 03 2018 13:07
vivekranjan92 sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 2208 | @ndburrus |http://www.freecodecamp.org/ndburrus
Norvin Burrus
@ndburrus
May 03 2018 13:07
@vivekranjan92 you're welcome! enjoy :+1:
Vivek Ranjan
@vivekranjan92
May 03 2018 13:07
But the thing is I have gone through the documentation that Amazon team has provided online. And I am still facing issue
@ndburrus
Aimée
@Aimee-MacDonald
May 03 2018 13:09
@khaduch Thanks, hi!
CamperBot
@camperbot
May 03 2018 13:09
aimee-macdonald sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3901 | @khaduch |http://www.freecodecamp.org/khaduch
Stephen James
@sjames1958gm
May 03 2018 13:11
@vivekranjan92 You will need to provide details about your issue
Kyle Holm
@thekholm80
May 03 2018 13:40
good morning, /help
Vivek Ranjan
@vivekranjan92
May 03 2018 13:40
Good Morning
@thekholm80
Aimée
@Aimee-MacDonald
May 03 2018 13:44
heya ;)
Daniel Simeonov
@dbsimeonov
May 03 2018 13:46
:wave:
1345964865
@1345964865
May 03 2018 13:47
:wave:
Kyle Holm
@thekholm80
May 03 2018 13:52
i'm pretty frustrated with jsonwebtoken's .verify() method. it throws an error if the token passed into it is invalid, and the only way i've been able to elegantly catch the error is a try/catch block. you would think they'd have a better way of informing you if the token is invalid
the docs say you can pass a callback as one of the arguments, with error as the first callback arg but it still throws the error instead of just passing it to the callback
xMaarf
@xMaarf
May 03 2018 14:48
i need some help with bootstrap 4, can anyone give me a hand?
May Kittens Devour Your Soul
@diomed
May 03 2018 14:49
what is it?
xMaarf
@xMaarf
May 03 2018 14:52
I'm trying to make a grid where I have 1 image on the left side with the same size of the container, and then 4 images on the right side (two on top, two on the bottom) and all fo them have text on the right side
I was able to make the design but it's not responsive at all
when I resize the screen the images and the text get over the other ones
and they also get out of the div
I cant see what im doing wrong
May Kittens Devour Your Soul
@diomed
May 03 2018 14:54
do you have a pen of that?
xMaarf
@xMaarf
May 03 2018 14:54
actually I don't
May Kittens Devour Your Soul
@diomed
May 03 2018 14:55
put your code online if u want someone to help u
xMaarf
@xMaarf
May 03 2018 14:56
alright, give me a second
I didn't post the images but you can see that the text gets on top of another
and since it its a one page website
the images and the text they get outside of the div and they get on top of the other divs
May Kittens Devour Your Soul
@diomed
May 03 2018 15:23
@xMaarf are u coding with bootstrap 4 or bootstrap 3?
xMaarf
@xMaarf
May 03 2018 15:23
bootstrap 4
May Kittens Devour Your Soul
@diomed
May 03 2018 15:23
coz u have included boostrap 3.3.7. as far as I can see
xMaarf
@xMaarf
May 03 2018 15:24
this is my first project with bootstrap 4 tbhwu
May Kittens Devour Your Soul
@diomed
May 03 2018 15:26
it's odd that in upper left corner says bootstrap 3.3.7
xMaarf
@xMaarf
May 03 2018 15:27
oh! its because of the pen
didnt switched to bootstrap 4
mb
here you go, should be fixed now
Ammiel
@aemc
May 03 2018 15:48
hey is any1 good at react-native here and has used a lib called react-native-dropdownalert?
Marco Oliva
@marcooliva
May 03 2018 16:00

Hello,
I am learning Redux with freecodecamp beta, and i have a problem.
In https://beta.freecodecamp.org/en/challenges/redux/create-a-redux-store i put the following code (but do not works):

const reducer = (state = 5) => {
  return state;
}

// Redux methods are available from a Redux object
// For example: Redux.createStore()
// Define the store here:

const store = createStore(reducer);

Can anyone help me, please?
Thanks.

Christopher McCormack
@cmccormack
May 03 2018 16:05
@marcooliva you should use Redux.createStore, like the example shows
Marco Oliva
@marcooliva
May 03 2018 16:07
@cmccormack I now wrote
const store = Redux.createStore(reducer);
but do not works.
Christopher McCormack
@cmccormack
May 03 2018 16:09
did you change anything else? Maybe try resetting the exercise
Marco Oliva
@marcooliva
May 03 2018 16:13
I did F5 and put the upper code with Redux and it worked.
It is odd because i didn't change anything above the code comments.
@cmccormack thanks for the help. :-)
CamperBot
@camperbot
May 03 2018 16:13
:star2: 1430 | @cmccormack |http://www.freecodecamp.org/cmccormack
marcooliva sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
Christopher McCormack
@cmccormack
May 03 2018 16:13
@marcooliva np
idris
@idris12
May 03 2018 16:21
Capture1.PNG
why does the first array return an empty value ?
Christopher McCormack
@cmccormack
May 03 2018 16:22
@idris12 because you assigned that value in your todo declaration
idris
@idris12
May 03 2018 16:23
ooh i see thank you
Capture2.PNG
also on this
why wasnt the return value 4,7,10
because i taught array starts from zero
Christopher McCormack
@cmccormack
May 03 2018 16:27
@idris12 num is the value in your array, not the index. forEach iterates over the array and the first parameter is the value at each position of the array, but also has an index parameter if you want to check that
arr.forEach(function callback(currentValue[, index[, array]]) {
    //your iterator
}[, thisArg]);
idris
@idris12
May 03 2018 16:30
ooh i see so in other for the the For each to iterate through the index you have to specify ?
am i right on that?
Christopher McCormack
@cmccormack
May 03 2018 16:31
forEach will iterate over every position of the array, and if you need to see the index you can provide a second parameter to your anonymous function for the index
Example:
> [4, 5, 6].forEach(function(value, index){ console.log('value: ' + value, 'index: ' + index) })
value: 4 index: 0
value: 5 index: 1
value: 6 index: 2
idris
@idris12
May 03 2018 16:38
ooh i see this explanation is much clearer now @cmccormack Thanks
CamperBot
@camperbot
May 03 2018 16:38
idris12 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1431 | @cmccormack |http://www.freecodecamp.org/cmccormack
Christopher McCormack
@cmccormack
May 03 2018 16:38
np
Aita Kane
@aita-kane
May 03 2018 16:50

@cmccormack alright thankyou

@aita-kane perhaps value is what is stored for the button element when submitted

CamperBot
@camperbot
May 03 2018 16:50
aita-kane sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1432 | @cmccormack |http://www.freecodecamp.org/cmccormack
xMaarf
@xMaarf
May 03 2018 17:10
@xMaarf
If i want to hide a col and all the elements inside it when the device size is small
<div className="col-md-3 m-0 p-0 d-flex align-items-center d-sm-none">
shouldn't this work?
Ashraf Patel
@AshrafPatel
May 03 2018 18:20
hey whats wrong with this code
function mutation(arr) {
  alert("heya howza".indexOf("hez") !== -1);
}

mutation(["hello", "hey"]);
its for the mutation challenge
it doesnt give same output with arr[0] and arr[1]
Ene Catalin
@EneCatalin
May 03 2018 18:36
anyone know any add free free hosting ?
Aita Kane
@aita-kane
May 03 2018 18:39
hello everybody will learning css-grid help you understand bootstrap grid?
Ene Catalin
@EneCatalin
May 03 2018 18:41
@ndburrus you're like a bot, but better
thanks
I love the lists
Norvin Burrus
@ndburrus
May 03 2018 18:42
@EneCatalin you're welcome :) thanks... :information_desk_person:
CamperBot
@camperbot
May 03 2018 18:42
ndburrus sends brownie points to @enecatalin :sparkles: :thumbsup: :sparkles:
:cookie: 453 | @enecatalin |http://www.freecodecamp.org/enecatalin
Kingsley
@Kingwindie
May 03 2018 19:11
const customerName = document.getElementById('customerName');
customerName.textContent = 'kfkbhs';

  <div class="name">
                <label for="name">Name:</label>
                <input type="text" id="customerName" name="customerName" placeholder="Enter full name">
            </div>
someone help me here,for some reason the js is not getting the id i want it to get from the html
the script source is correct because when i put an alert it will show in the browser,so it's not that
Kingsley
@Kingwindie
May 03 2018 19:14
const message = document.getElementById('message');
message.textContent = 'This is the message';



            <p>Check this box if you want your message to be displayed publicly.</p>
            <input type="checkbox" name="checkBoxText" id="checkBoxText">
this one works but the input field does not
nevermid,for some reason it does not like text content,i just tried to change the background color and that works perfectly fine
Daniel Simeonov
@dbsimeonov
May 03 2018 19:24
my life is been a lie, I though that grid is using flexbox.. The one I made for myself I used it was with flexbox and just realized I've never used grid :O @ndburrus thanks for the links :D
CamperBot
@camperbot
May 03 2018 19:24
dbsimeonov sends brownie points to @ndburrus :sparkles: :thumbsup: :sparkles:
:star2: 2211 | @ndburrus |http://www.freecodecamp.org/ndburrus
Norvin Burrus
@ndburrus
May 03 2018 19:26
@dbsimeonov you're welcome! ...we learned something :candy:
Daniel Simeonov
@dbsimeonov
May 03 2018 19:28
@ndburrus So something like this is something like flexbox layout? I'm just interested what I've done
May Kittens Devour Your Soul
@diomed
May 03 2018 19:46
@EneCatalin he's AI
Kyle Holm
@thekholm80
May 03 2018 19:46
lol
May Kittens Devour Your Soul
@diomed
May 03 2018 19:46
ostrich, I've heart github offers free hosting and you already have github account
@thekholm80 I left u messages on discord. they're not even cries for help. but u dont coal , u don't write
Kyle Holm
@thekholm80
May 03 2018 19:52
my discord game is weak
Ene Catalin
@EneCatalin
May 03 2018 20:55
such lies. He clearly doesn't care about cat, he only cares about beard
Kyle Holm
@thekholm80
May 03 2018 20:55
beard's gone for the summer
too hot
Saad Elkheety
@Saadelkheety
May 03 2018 20:58
I have completed all the challenges but can't claim the certificate
image.png
Ene Catalin
@EneCatalin
May 03 2018 20:59
@thekholm80 YOU MONSTER
Kyle Holm
@thekholm80
May 03 2018 20:59
@Saadelkheety no certs on beta, sorry
save your work and you can turn it in when beta becomes the stable
Saad Elkheety
@Saadelkheety
May 03 2018 21:01
@thekholm80
Thanks
CamperBot
@camperbot
May 03 2018 21:01
saadelkheety sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1784 | @thekholm80 |http://www.freecodecamp.org/thekholm80
May Kittens Devour Your Soul
@diomed
May 03 2018 21:04
@Saadelkheety wouldnt kill you to add some css library
or improve typography
Leep nightwatch
@Leep000_twitter
May 03 2018 21:26
Hello everyone ! i have a side project of mine where i need to get data from mysql database and update the paragraphs in my html/php file acordingly . its single page so it cannot reopen . i was thinking to use php to get the form information and create a sql query from that and pass those values back with maybe ajax ? i'm i on the right path or is there anoteher way ? i looked everywhere and could not find a proper answer feel free to help i dont need the right code but just someon who could tell me i'm on the right way :D Ty in advance
tastyviet
@tastyviet
May 03 2018 22:23
i need help
what is the symbol to insert code in the chat?
Stephen James
@sjames1958gm
May 03 2018 22:27
@tastyviet Three backticks on their own line, paste then three more back ticks on their own line
tastyviet
@tastyviet
May 03 2018 22:28
thank you !