Error in the second task
server.js
client.js
when making the request with the platform task I do not pass the test, I am having problems with approval.
server.js
client.js
when making the request with the platform task I do not pass the test, I am having problems with approval.
Hello there,
Where did you get this code from: Do$(document).ready(function() {
// This file's full path is /public/client.js
Do$(document).ready(function() {
/*global io*/
let socket = io();
Can you see the issue there?
Retirei o DO antes do $
Obtendo a mesma resposta invalidando o codigo mesmo ja fazendo o pedido de desconeção do usuario .
Repository Solution
I cannot help, if I do not have your latest code. When I go to your repository, I still see this:
// This file's full path is /public/client.js
Do$(document).ready(function() {
/*global io*/
let socket = io();
Please either link to a Replit, Glitch, or CodeSandbox of your project. Or, provide the most up-to-date code you have.
Where are you hosting this app?
Utilizei as informações da solução do FCC apresentada no link abaixo:
O repositório fiz o import no CodeSandBox
You appear to be confusing the different challenges:
These are the tests for the Camperbot code you linked:
These are the tests for the challenge after the code you linked
https://global.discourse-cdn.com/freecodecamp/original/3X/1/0/10b80c6827e7e19aca1c3bf20d392aaffc074e1e.png
Which lesson are you on?
Refiz o CodeSandbox
Erro nas seguintes tasks não passa na segunda questão pedida
OBS: O codigo não será passado havia dado sequencia, no entanto ele passa na primeira questão mas na segunda ele da erro.
Há erro nestas duas questões mesmo colocando da forma apresentada nas tasks mais completo esta resposta .
What you have:
socket.on('disconnected', () => {
console.log('A user has disconnected');
...
});
What the solution has:
socket.on('disconnect', () => {
console.log('A user has disconnected');
...
});
Can you see the difference?
Honestly, I am still confused which lesson you are on. It is not advisable to move to the next lesson, when you have not completed the previous lesson. This will cause neither of the tests to reliably pass.
My recommendation: Go to the most recent challenge where you passed all the tests, and copy the given solution code. Then, complete the proceeding challenges one by one.
Hope this helps
Vou realizar a reformulação do primeiro erro no codigo para o erro desconexão .
Retornei o codigo para versão desta questão
O erro:
O evento ‘user count’ não consigo fazer com que ele seja ouvido o que não passa mesmo o codigo estando dentro dos conformes junto a Solução.
Repositorio:
I am sorry, if there is a language barrier between us. So, I will try to make this as translatable as possible:
The test is saying the code in the client.js
file should have an event listener (socket.on
) for the 'user count'
event.
This is your client.js
code:
socket.on('user', (data) => {
$('#num-users').text(data.currentUsers + ' users online');
let message = data.name + (data.connected ? ' has joined the chat.' : ' has left the chat.');
$('#messages').append($('<li>').html('<b>' + message + '</b>'));
});
I cannot see anywhere in your code a listener for 'user count'
.
I believe this is an issue, because you did not reset the client.js
file. So, please copy this code into your client.js
file. This is needed to complete the above mentioned lesson:
ONLY COPY THE client.js
FILE. DO NOT COPY THE server.js
FILE (your code for this is correct, as far as I can see).
Hope this helps
I will resume this one in case I return to comment again here if you have available to give me a help.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.