Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 01 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
Eric Weiss
@eweiss17
@BrianWilliams28 if you are used to using jquery, there is a jquery to base js converter
Fernando L. Estuesta
@champolot
Is there any one here could explain why I get an error on this code
Daniel Simeonov
@dbsimeonov
Send it and we will try to help you
Fernando L. Estuesta
@champolot
UI.prototype.showAlert=function(message,class name)
It says classname is not declared but it's value is never read
Eric Weiss
@eweiss17
can u give the relevant code snippets
Fernando L. Estuesta
@champolot
Sorry for the typo on my code. That's className
BrianWilliams28
@BrianWilliams28
@br3ntor yeah but I want each LI to have different content xD
Fernando L. Estuesta
@champolot

heres the full code

function Book(title, author, isbn) {
this.title = title;
this.author = author;
this.isbn = isbn;
}

function UI() {}

UI.prototype.addBookToList = function(book) {
const list = document.getElementById('book-list');
const row = document.createElement('tr');
row.innerHTML = <td>${book.title}</td> <td>${book.author}</td> <td>${book.isbn}</td> <td><a href="#" class="delete">X </a></td>;
list.appendChild(row);
};

UI.prototype.showAlert = function(message, className) {};

UI.prototype.clearFields = function() {
document.getElementById('title').value = '';
document.getElementById('author').value = '';
document.getElementById('isbn').value = '';
};

document.getElementById('book-form').addEventListener('submit', function(e) {
const title = document.getElementById('title').value,
author = document.getElementById('author').value,
isbn = document.getElementById('isbn').value;

const book = new Book(title, author, isbn);

const ui = new UI();

if (title === '' || author === '' || isbn === '') {
ui.showAlert('Please fill all', 'error');
} else {
ui.addBookToList(book);
ui.clearFields();
}

e.preventDefault();
});

xDDD
Daniel Simeonov
@dbsimeonov
What error gives you, className not defined? Did you try to register it and writing some output in the function instead being empty?
Im not expert with prototype functions but never seen that approach :D
Fernando L. Estuesta
@champolot
any thing that is inside the function
Markus Kiili
@Masd925
@champolot You have commas at the ends of lines there const title = document.getElementById('title').value,. Should they be semicolons?
Daniel Simeonov
@dbsimeonov
I think that was a way to assign multiple variables like he did ?
Markus Kiili
@Masd925
oh yes, you are right. Missed the const there.
Fernando L. Estuesta
@champolot
it was actually working
Ghost
@ghost~5a7ec891d73408ce4f8c87b2
I'm facing one problem in HTML, CSS
that I can't add Background Image to HTML file with /photos/xyz.jpg that need complete file url, like file:///C:/Users/Name%20Name%20Name/Desktop/Coursera%20Learning/Portfolio%20New%201/images/iPhone.jpg
why ?
please help me out
Eric Weiss
@eweiss17
are you developing locally?
Dany Din
@danydin
hey someone is here
Christopher McCormack
@cmccormack
@danydin who is it?
Dany Din
@danydin
when i use the stringify and the parse im confused a bit @cmccormack
Christopher McCormack
@cmccormack
@danydin what's your confusion?
Dany Din
@danydin
like when i make a call and i get the data
to manipualte it i need to parse it first
do i need to stringify it again afterwards?
hensn5250
@hensn5250
@danydin the data can be manipulated when in JSON form, so if it is in JSON form no need to Stringify it.

"A common use of JSON is to exchange data to/from a web server.

When receiving data from a web server, the data is always a string.

Parse the data with JSON.parse(), and the data becomes a JavaScript object."

Dany Din
@danydin
@hensn5250 thanks why i see sometimes variables without the var
hensn5250
@hensn5250
No prob.
In JavaScript undeclared variables are global by default.
"If you assign a value to a variable that has not been declared, it will automatically become a GLOBAL variable."
JavaScript Scope
Dany Din
@danydin
@hensn5250 you're amazing
hensn5250
@hensn5250
JSON is JavaScript Object Notation , its just a ** Stringified JS object --> ' { key: value}'
Aditya
@ezioda004
Its a stringified JS object*
hensn5250
@hensn5250
^^ right
Dany Din
@danydin
oh ok thanks and what-when we use the stringify method? @hensn5250 @ezioda004
Aditya
@ezioda004
@danydin When you're sending data from frontend to server and vice versa.
Dany Din
@danydin
thanks! why fcc chat is dead does everybody gave up on programming or it just that they all too advanced for this place :P @ezioda004
Aditya
@ezioda004
@danydin Mainly because gitter chats were removed from fcc challenges. Usually Javascript and Help rooms are active.
Christopher McCormack
@cmccormack
Yeah I think Gitter link was removed from the entire cirriculum site
used to be in Settings after it was taken out of the challenges but I don't see it anymore
Dany Din
@danydin
ahh i see... i remember it from long ago wired that they took it off it's pretty helpful and unique
and was pretty popular as well a while ago
Brad
@bradtaniguchi
I think FCC wanted to focus on the forums as the goto source. The thing about the chat rooms (especially the general room) was it was off topic more often than not
Dany Din
@danydin
well maybe the general the rest were pretty mch straight to the point
Brad
@bradtaniguchi
Yea, I think it was quincy's decision. Oh well
Dany Din
@danydin
wired they took it off i dont get what stands behind this decision