These are chat archives for FreeCodeCamp/HelpJavaScript

29th
Apr 2018
jusgoose
@gusd773
Apr 29 2018 00:28 UTC
anybody know why my photo won't show up using inline styling?
<section id="content-area">
            <div class="side-column">
                <div class="widget-box intro">
                    <div class="head">
                        <div class="widget-image">img</div>
                        <div class="widget-title">title</div>
                    </div>
                    <div class="body">
                        <h6></h6>
                        <p></p>
                        <p></p>
                        <a href="#">update info</a>
                    </div>    
                </div>    
                <div class="widget-box photos">
                    <div class="head">
                        <div class="widget-image">img</div>
                        <div class="widget-title">title</div>
                    </div>
                    <div class="body">
                            <div style="float:left; display:inline-block; width:33.33%; height: 110px; background: url("http://hdbackgroundspic.com/wp-content/uploads/2017/10/full-snow-fall-on-mountain-image.jpg") no-repeat center center; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;"></div>
                     </div>    
                  </div>
              </div>
        </section>
    </body>
</html>
this is what renders
blob
Moisés Man
@moigithub
Apr 29 2018 00:37 UTC
cuz its floated... probably is behind the imge/div above
try to set a z-index to check
kellic89
@kellic89
Apr 29 2018 00:45 UTC
so I am wayyyy new to the Javascript language. I need some assistance with a code..

function addToCart(e){
var albumid = e.currentTarget.id;
for(var i=0; i<dbArray.length; i++)
{
if(dbArray[i].id == albumid)
cart.push(dbArray[i]);
}
}

The part of the assignment I cant figure out is this:

When I click the "Add To Cart" button, the album that I clicked should be added to my a cart. Here's some things to help you out. In your html, give each of the btns a css class such as “addBtn-class”. Then when you set up your listeners, retrieve all the elements by that certain class. Then iterate through the collection and add the handler to the onclick event. Add the id of each album to the html element itself. Then you can use the event argument to find the source id and use that to search for the album in the database.

  1. When the items are added, in the upper right hand I want to see a hyperlink that looks like:
    cart(5)
    That 5 should display how many items are in my cart. What does the length property of an array give you? What can you do with .innerHTML?
jusgoose
@gusd773
Apr 29 2018 03:11 UTC
@moigithub tried the z index no luck (I added "z-index: 1;" to the long mumo jumbo inline styling)
jusgoose
@gusd773
Apr 29 2018 03:16 UTC
can anyone help?
abraham anak agung
@padunk
Apr 29 2018 04:05 UTC
@gusd773 remove double quote on your url
background: url(http://hdbackgroundspic.com/wp-content/uploads/2017/10/full-snow-fall-on-mountain-image.jpg)
花非花
@chenchunhuascut
Apr 29 2018 05:52 UTC
amazing
Rajat
@rajataudichya
Apr 29 2018 06:32 UTC
@kellic89 try to add your code this way [js """your code"""]
Johnny
@JohnnyBizzel
Apr 29 2018 07:17 UTC
@rajataudichya That video is out of date. The link to the wiki about backticks is now in the forum.
Derrick Hsiao
@DerrickHsiao
Apr 29 2018 11:23 UTC

I need some help

function queue(arr, item) {
  // 请把你的代码写在这里
  arr.push(item);
  arr.shift(0);
  return item;  // 请修改这一行
}

// 初始化测试数据
var testArr = [1,2,3,4,5];

// 控制台输出
console.log("Before: " + JSON.stringify(testArr));
console.log(queue(testArr, 1)); // 你可以修改这一行来测试你的代码
console.log("After: " + JSON.stringify(testArr));

pleas help me to pass this challenge

Tan jin
@Tan-jin
Apr 29 2018 11:32 UTC
I need some help.
vv
image.png
Tan jin
@Tan-jin
Apr 29 2018 11:38 UTC
I think I know it.
Norvin Burrus
@ndburrus
Apr 29 2018 12:40 UTC
@Tan-jin is it resolved?
@DerrickHsiao which challenge title is this ?
Norvin Burrus
@ndburrus
Apr 29 2018 12:48 UTC
@Tan-jin @kellic89 these may be helpful: :sparkles:
MarkNyan
@Mark-Nyan
Apr 29 2018 13:11 UTC
@Tan-jin result= myNoun+" "+ myAdjective+" "+ myVerb +" "+myAdverb;
DongLiang
@dongliangs
Apr 29 2018 14:55 UTC

I need help;
```var count = 0;

function cc(card) {
// 请把你的代码写在这条注释以下
if(card > 1 && card < 7){
return "(count++)+''Bet+";
}

return count++;
// 请把你的代码写在这条注释以上
}

// 你可以在这里添加/删除 cc 方法的调用来测试结果
// 提示: 左边只会显示最后一次执行的返回值
cc(2); cc(3); cc(7); cc('K'); cc('A');
```

DongLiang
@dongliangs
Apr 29 2018 15:08 UTC
I solved my problem
Stephen James
@sjames1958gm
Apr 29 2018 15:12 UTC
@dongliangs :+1:
AbrisM
@AbrisM
Apr 29 2018 16:27 UTC
Anyone alive?
Whos familiar with GPO settings?
@dongliangs Great. From what it looks like your variable named count was initalized or set to 0. Then your function aka method called cc ran the parameter of card (whatever cards represent). You then had an if statement, okay. If card is greater than one BUT less than 7, return count(+1) and whatever BET represents. Then automatically add+1 to count regardless of the if statment. So you have count returning +1 twice. I'm not sure what the comments mean but I see a c(2), cc(3) and sofourth. Were you trying to run the method of cc with the parameters of 2, 3, etc
and a char 'A'
Brian
@BrianCodes33
Apr 29 2018 23:14 UTC
does someone know how to do own TDD tests in code wars
Gulsvi
@gulsvi
Apr 29 2018 23:25 UTC
@BrianCodes33 You may want to ask here: https://gitter.im/Codewars/codewars.com
kellic89
@kellic89
Apr 29 2018 23:38 UTC
function addToCart(e){
  var albumid = e.currentTarget.id;
  for(var i=0; i<dbArray.length; i++)
    {
      if(dbArray[i].id == albumid)
        cart.push(dbArray[i]);

    }
   // document.getElementById('cart').innerHTML = cart.length;
  }
I tried adding this code last night, but formatted it wrong. Hopefully this formats correctly.
I need help with adding code for the cart to update how many items are in it. I feel like I am on the right track, but I am really lost at the same time.
The commented out section is what I started to code, but got lost.