These are chat archives for FreeCodeCamp/Help

25th
Mar 2019
Lh0621
@Lh0621
Mar 25 01:25
hello,who can tell me how to use the "a" in the "cat photos"
BuntyBru
@BuntyBru
Mar 25 06:27
@cmccormack
so that means the group is done and dusted ?
psyperl
@psyperl
Mar 25 07:44
I don't think it's ded, people just got busier which can be a good thing
kibablu
@kibablu
Mar 25 08:01
We have created a room for beginners "HelpBeginner"
hello,who can tell me how to use the "a" in the "cat photos"do you meant anchor tag? paste your problem
CSS and HTM
lianghuibiao
@lianghuibiao
Mar 25 08:28
hello
TheCodingAlien
@TheCodingAlien
Mar 25 09:16
could someone help solve some errors in my script.js file please

`` var questions = [
{
text: "Which of the following options will convert the OBI_NOTE field content to a HTML output?", // one string
options: ["«OBI_NOTE&HTML»" , "«OBI_NOTE&H»" , "«OBI_NOTE&CONVERT.HTML&D1»"] , //three strings // - object 1
chosen: null
},
{
text: "What is the name of the query language used to query Oracle database?", // one string
options: ["PLSQL" , "TSQL" , "MDX"] , //three strings //-object 2
chosen: null
},

];
// Javascript for submitting test & get results button
function completeTestButton() {
$.post("http://127.0.0.1:8080/complete-test",
{
text: "",
options: "",
chosen: ""
}),

function(data,completeTestResultstatus){
  alert("Data: " + data + "\nCompleteTestResultstatus: " + completeTestResultstatus);
};

var chosen;
if {
console.log("click ok!");
};

// ================================================================================================================

var escape = document.createElement('textarea');

function escapeHTML(html) { escape.textContent = html; return escape.innerHTML; }

function questionToHtml(question, index){ //2 parameters
var html = <h2>${question.text}</h2>; // string literal. it puts the value 'question.text' inside there. takes 'text from config above etc'
html += <div data-question-index="${index}">;
question.options.forEach(function(option, index) {
html += optionToHtml(option, index, question.chosen);
}); //
html += '</div>';
return html;
}
function optionToHtml(option, index, chosen){ //2 parameters // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce - accumulator is htmk, therefore had to be changed from the 3rd inline to the first - as example suggests
option = escapeHTML(option);
var html = <div class="option"><input type="radio" id="choice${index}" name="choice" value="${index}";
if (''+index === chosen) {
html += ' checked';
}
html += ><label for="choice${index}">${option}</label></div>; // string literal. it puts the value 'question.text' inside there
//uses the options to give us all the options in the config described above //uses the index so it separates all the bits in the page
return html;
}
function writeQuestion (number){ //turn question into HTML
var current = questionToHtml (questions[number],number);
quizElement.innerHTML = current ;
addQuestionListener (quizElement);
}
function addQuestionListener (quizElement){
var inputs = quizElement.querySelectorAll('input');
inputs.forEach (addOptionListener); //https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
}
function addOptionListener (input){
input.addEventListener("change", optionChange);

}
function optionChange (e){
var currentQuestion = parseInt(this.parentElement.parentElement.getAttribute("data-question-index"), 10);
var currentOption = this.value ;
if (this.checked) {
questions[currentQuestion].chosen = currentOption;
}
}
function generatePagination (currentQuestion) {
var lastIndex = questions.length - 1 ;
var previous = Math.max(currentQuestion - 1, 0);
var next = Math.min(currentQuestion + 1, lastIndex);

// write previous link
var html = <a href="#" data-page="${previous}">&laquo;</a>;
// write question links
html += questions.reduce(questionToPagination, ''); //
//write next link
html += <a href="#" data-page="${next}">&raquo;</a>;

// write to the DOM
paginationElement.innerHTML=html;

// add handlers to links
addPaginationListener (paginationElement);
}
function addPaginationListener (paginationElement){
var links = paginationElement.querySelectorAll('a');
links.forEach (addLinkListener); //https://developer.mozilla.org/en-US/docs/Web/API/NodeList/forEach
}
function addLinkListener (link){
link.addEventListener("click", changePage);
} ``

`` function changePage (e){
var page = parseInt(this.getAttribute ("data-page"), 10);
if (currentQuestion === page) {
// don't redraw if page is this page
return;
}

// Save selection and show page
currentQuestion = page;
writeQuestion (page);
generatePagination(page);
}
function questionToPagination (html, question, index) {
var humanFriendly = index+1;
return html + <a href="#" data-page="${index}">${humanFriendly}</a>;
}
// debugging protocol
function isValidQuestion(question, index) {
var isValid = Array.isArray(question.options) &&
typeof(question.text) === 'string' &&
typeof(question.chosen) !== 'undefined';

if (!isValid) {
  console.warn("Found invalid question at index " + index, question);
}
return isValid;

}

//re display user selection

// ================================================================================================================
// get quiz space
var quizElement = document.getElementById("quiz"); // function to be called. documentgetElement calls the function from the DOM. writing functuion instead of var defines it.
var paginationElement = document.getElementById("pagination");
var currentQuestion = 0;

questions = questions.filter(isValidQuestion);

//display HTML
writeQuestion (currentQuestion);
generatePagination(currentQuestion);
``

Prana Apsara W
@pranahonk
Mar 25 10:49

@pranahonk
halo everyone, i want to ask about javascript

 p.textContent = `${movie.description}...`

do you know what is `${movie.description}...` mean

Promise Tochi
@Promhize
Mar 25 13:06
@pranahonk that's a template literal https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals, it's same as doing movie.description + "..."
Engjell Bislimi
@Engjell00
Mar 25 13:41
can someone help me with github pages. I made a repo gave it the same name as my username.github.io, I uploaded my portfolio in the repo, if i try to go to my link it says error 404
Christopher McCormack
@cmccormack
Mar 25 14:59
@BuntyBru nope it's still going, some of the channels are more active than others, and usually only during weekdays.
armoredblob
@armoredblob
Mar 25 16:10
I cannot figure out what I am doing wrong: a:hover { color: blue; }
a:hover {
color: blue;
}
psyperl
@psyperl
Mar 25 16:12
@armoredblob what does a:hover selector meant?
Jason Luboff
@JLuboff
Mar 25 16:12
That looks fine to me
armoredblob
@armoredblob
Mar 25 16:13
@psyperl it changes the color of a link when you hover your cursor over it.
it's not letting me complete the challenge for some reason.
Jason Luboff
@JLuboff
Mar 25 16:14
Try refreshing the page (copy your code first as it may delete it)
armoredblob
@armoredblob
Mar 25 16:14
@psyperl the a is for the anchor element and the :hover is the attribute, i think.
i already reset the code twice and refreshed the page.
Jason Luboff
@JLuboff
Mar 25 16:15
Can you provide a link to the challenge?
Jason Luboff
@JLuboff
Mar 25 16:17
Can you provide the full code that you have? What you have works fine for me
armoredblob
@armoredblob
Mar 25 16:17
Hm. Alright:

<style>

a:hover {
color: blue;
}

</style>
<a href="http://freecatphotoapp.com/" target="_blank">CatPhotoApp</a>

Jason Luboff
@JLuboff
Mar 25 16:18

Why did you remove

  a {
    color: #000;
  }

?

armoredblob
@armoredblob
Mar 25 16:18
I didn't realize it was blue until later. should i put it back in?
Jason Luboff
@JLuboff
Mar 25 16:18
Yes
armoredblob
@armoredblob
Mar 25 16:19
I put it back in but it still won't work and now my error is showing that i need to specify the color blue.
"The anchor tag should have a color of blue upon hover."
Stevie
@Whip
Mar 25 16:19
https://pastebin.com/M7S7Ykdv
If someone could help break this down to me through a PM you'd be a huge help.
Jason Luboff
@JLuboff
Mar 25 16:20
@armoredblob Show your updated code please
armoredblob
@armoredblob
Mar 25 16:20

<style>

a:hover {
color: #000;
}

</style>
<a href="http://freecatphotoapp.com/" target="_blank">CatPhotoApp</a>

Jason Luboff
@JLuboff
Mar 25 16:21
You need to have both
a {
}

a:hover {
}
armoredblob
@armoredblob
Mar 25 16:21
Oh!
Okay!
When I put in the #000, it shows the link as being blue in its ordinary state and black upon hover.
when i put in the color: blue, it is black in ordinary state and blue upon hover.
it's still not working. is there something that is supposed to go between the {} in a?
Jason Luboff
@JLuboff
Mar 25 16:23
It should be black and then turn blue on hover
Yes.. what was originally there
armoredblob
@armoredblob
Mar 25 16:24
Terminated. Thanks so much, @JLuboff !!! <3
Jason Luboff
@JLuboff
Mar 25 16:24
:thumbsup:
Stevie
@Whip
Mar 25 16:42
If someone could PM me and help me with some basic java script it would help me a lot.
psyperl
@psyperl
Mar 25 16:47
num = num1 + num2 ?
Christopher McCormack
@cmccormack
Mar 25 16:48
@Whip if you have questions better to ask in the channel, or ask in the forums. Private conversations don't help others learn from your questions
psyperl
@psyperl
Mar 25 16:48
^
BuntyBru
@BuntyBru
Mar 25 16:49
@cmccormack
by other channels you mean "You can do this" and "data science" , "python" etc
Stevie
@Whip
Mar 25 16:49
https://pastebin.com/M7S7Ykdv
im having a hard time grasping this.
psyperl
@psyperl
Mar 25 16:56
@Whip which part confuses you?
// In this exercise, you will be given two variables, they will be called: num1 and num2
or
// On the next line create a variable called 'sum' and using math operators return num1 added to num2
?
Stevie
@Whip
Mar 25 17:15
On the next line create a variable called 'sum' and using math operators return num1 added to num2
psyperl
@psyperl
Mar 25 17:15
@Whip how do you create a variable?
Stevie
@Whip
Mar 25 17:17
keyword + space + name = right?
psyperl
@psyperl
Mar 25 17:17
yup
and that text want you to name it as sum
Stevie
@Whip
Mar 25 17:18
its more the "return num 1 added to num 2" that confuses me
psyperl
@psyperl
Mar 25 17:18
maybe just the value of the sum is num1 + num2 ?
because the text is returning sum at the end.. so maybe they want the addition to be kept at sum variable
Stevie
@Whip
Mar 25 17:22
ahh i got it
thanks!
i was over thinking it
LOL
psyperl
@psyperl
Mar 25 17:23
awesome, yeah you over thinking it
Christopher McCormack
@cmccormack
Mar 25 18:13
@BuntyBru yeah - https://gitter.im/FreeCodeCamp/home I know HelpJavaScript is fairly active during weekdays
Stevie
@Whip
Mar 25 18:21
https://pastebin.com/BBAT9Ja5
if someone could help me with this that would be awesom e
Stevie
@Whip
Mar 25 18:26
Thanks boss,
psyperl
@psyperl
Mar 25 18:27
:thumbsup:
gabriel
@Boydoesgaming_twitter
Mar 25 20:21
hi?
Christopher McCormack
@cmccormack
Mar 25 20:22
@Boydoesgaming_twitter hello ?
gabriel
@Boydoesgaming_twitter
Mar 25 20:22
hi
im stuck on one
Christopher McCormack
@cmccormack
Mar 25 20:27
@Boydoesgaming_twitter go ahead and ask your question, hopefully someone can help
Stevie
@Whip
Mar 25 22:23
@Whip
https://pastebin.com/3aZcRKpg if someone could point me in the right direction that would be awesome
"using the length property assign the new variable to the length of str " is confusing me
Razin Rahman
@raisinrahman
Mar 25 23:02
Hey people 👋😁👋
Philip Durbin
@pdurbin
Mar 25 23:15
seems like you're close, @Whip
Stevie
@Whip
Mar 25 23:33
i got it thankfully @pdurbin
Philip Durbin
@pdurbin
Mar 25 23:45
phew
nsonhouse
@nsonhouse
Mar 25 23:58
@cmccormack Hey Chris