I am trying to use an arrow function and I am getting an error when I attempt to assign a variable
let cardColor;
let fontColor;
let toggleSidebarInfo = () => {
let colors;
$('.client-director, .person-link, .card-picture').click((evt) => {
employeeId = evt.target.id;
///// FOCUS ON THIS PART //////
colors = $(this).hasClass('card-picture') ?
(cardColor = $(this).next().css('backgroundColor'),
fontColor = $(this).next().css('color')) :
(cardColor = $(this).css('backgroundColor'),
fontColor = $(this).css('color'));
/////////////////////////
compareId(employeeId);
});
};
if I console log cardColor
of fontColor
I get undefined as I am doing
.click((evt) => { . . . });
but if I do it the regular way
.click(function(evt) { . . . });
then everything works properly.
What am I missing?