skycoder01 sends brownie points to @furball514 :sparkles: :thumbsup: :sparkles:
:cookie: 167 | @furball514 |http://www.freecodecamp.com/furball514
function mutation(arr) {
var one=arr[0];
var two=arr[1];
one.toLowerCase();
two.toLowerCase();
var array=two.split("");
for(var i=0;i<array.length;i++){
if(one.indexOf(array[i]) !== -1){
return false;
}else return true;
}
}
mutation(["hello", "hey"]);
This is the function for Mutation Challenge. The function is given an array of 2 elements, 2 string to be exact. If the first element has everysingle letter in the second element (just one time, no case, no order), then the function returns true, if not false.
hey and hello works. But for example, mutation(["zyxwvutsrqponmlkjihgfedcba", "qrstu"]) is not returning true, somehow. I suspect there is something wrong with my if statement nested inside my for loop. Am I returning false or true multiple times, or some other problem?
var arr=[1,1,1,1];
function same(){
for (j=0;j<arr.length;j++) {
for (k=j+1;k<arr.length;k++) {
if (arr[k]==arr[j]){
return true;
}
}
}
return false;
}
Why doesnt this see that there are duplicates in my code? or vice versa?
@123xylem
function same(arr){
for (let j=0;j<arr.length;j++) {
for (let k=j+1;k<arr.length;k++) {
if (arr[k]==arr[j]){
return true;
}
}
}
return false;
}
same([1,1,1,1]);
try this
sethdcd sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1237 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
.indexOf
to be === -1
, then you want to return false - meaning that you didn't find the character in your string. Oh, and I just noticed that your .toLowerCase()
method calls are not updating the values of one
and two
- those methods return an array that is lowercased, they do not modify the original array in place. Then that almost all pass - for some reason the first one doesn't?
return true;
from within the for
loop - this is similar to the profile lookup, if you've done that already, where you cannot determine if everything is found until you've been through the entire string. So you can return false
from within the loop, because that automatically means you didn't find a character, but only return true if you have gotten all the way through your letters in the second string.
hello911 sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2404 | @khaduch |http://www.freecodecamp.com/khaduch
col-xs-12
classes in, so it fills the page.
johnnybizzel sends brownie points to @sethdcd :sparkles: :thumbsup: :sparkles:
:cookie: 121 | @sethdcd |http://www.freecodecamp.com/sethdcd
document.getElementById("SubTitle").innerHTML =famousQuotesA[Math.floor(Math.random())*famousQuotesA.length]);
.center-block
and .align-middle
or text-center
and none of it works. the text and buttons stay in the same place no matter what class i put on them. any help here, please in getting this stuff centerd within the Jumbotron, please? here is the codepen — http://codepen.io/faddah/pen/egVyrM
.done()
or something.
</section>
tag comes after a few elements - the header, the buttons, etc. If you put a text-center
class along with the jumbotron
class - it does center the buttons and everything in the section until the closing </section>
tag. Do you want to make your jumbotron extend throughout the page? Then you need to move that </section>
tag down to the bottom?
Channel
object. What I need to find out now is how to get the data stored into variables independently of the HTML append, etc. without setting everything to synchronous.
ctiller93 sends brownie points to @khaduch and @paulotokimatu :sparkles: :thumbsup: :sparkles:
:cookie: 377 | @paulotokimatu |http://www.freecodecamp.com/paulotokimatu
:star2: 2405 | @khaduch |http://www.freecodecamp.com/khaduch
https://cdnjs.cloudflare.com/ajax/libs/tether/1.3.1/js/tether.min.js
https://v4-alpha.getbootstrap.com/components/tooltips/#overview
I did not read that before, but the first item in the documentation mentions that
faddah sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 2406 | @khaduch |http://www.freecodecamp.com/khaduch
text-center
on that part causes the text to be centered within the frames, but the iframes themselves are not centered on the page. I think that's what I saw going on there? It was a while ago that I looked at it.
faddah sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:warning: faddah already gave khaduch points
lolz
@jtan3 In your code, you have to move this:
var name=data.stream.channel.name;
var game=data.stream.channel.game;
var logo=data.stream.channel.logo;
to the section where you know they're online, otherwise the data doesn't exist and it errors out
.jumbotron-fluid
and .container-fluid
would keep it responsive.
.button-group
and such down where they belong.
faddah sends brownie points to @skycoder01 :sparkles: :thumbsup: :sparkles:
:cookie: 108 | @skycoder01 |http://www.freecodecamp.com/skycoder01
.container-fluid {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.jumbotron-fluid
is what you add to .jumbotron
to have it extend to both sides, left & right of the window with no rounded corners. see — https://v4-alpha.getbootstrap.com/components/jumbotron/
faddah sends brownie points to @skycoder01 :sparkles: :thumbsup: :sparkles:
:warning: faddah already gave skycoder01 points
$("#clickHere").text(qLink.quoteText);
qTweet =......
and it will work
In the JSON exercise: https://www.freecodecamp.com/challenges/convert-json-data-to-html
the code given is this:
<script>
$(document).ready(function() {
$("#getMessage").on("click", function() {
$.getJSON("/json/cats.json", function(json) {
var html = "";
// Only change code below this line.
json.forEach(function(val) {
var keys = Object.keys(val);
html += "<div class = 'cat'>";
keys.forEach(function(key) {
html += "<strong>" + key + "</strong>: " + val[key] + "<br>";
});
html += "</div><br>";
});
// Only change code above this line.
$(".message").html(html);
});
});
});
</script>
In there, a foreach loop is applied to the json variable (which contains the JSON), which is a string type as far as I can understand. From what I know, the foreach loop can only be applied to arrays. This confuses me as I understood a JSON to be a string.
In the previous example too, the JSON is wrapped in square brackets, which I can’t understand. Is JSON an array here?
athabasco sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1153 | @sorinr |http://www.freecodecamp.com/sorinr
In the previous exercise: https://www.freecodecamp.com/challenges/get-json-with-the-jquery-getjson-method this is the some of the code that is used:
$("#getMessage").on("click", function(){
// Only change code below this line.
$.getJSON("/json/cats.json", function(json){
$('.message').html(JSON.stringify(json));
});
// Only change code above this line.
});
The output generated is this:
[{"id":0,"imageLink":"https://s3.amazonaws.com/freecodecamp/funny-cat.jpg","altText":"A white cat wearing a green helmet shaped melon on it's head. ","codeNames":["Juggernaut","Mrs. Wallace","Buttercup"]},{"id":1,"imageLink":"https://s3.amazonaws.com/freecodecamp/grumpy-cat.jpg","altText":"A white cat with blue eys, looking very grumpy. ","codeNames":["Oscar","Scrooge","Tyrion"]},{"id":2,"imageLink":"https://s3.amazonaws.com/freecodecamp/mischievous-cat.jpg","altText":"A ginger cat with one eye closed and mouth in a grin-like expression. Looking very mischievous. ","codeNames":["The Doctor","Loki","Joker"]}]
Doesn’t the stringify method convert a Javascript object into a JSON? So shouldn’t the above output have single quotes instead of square brackets wrapping it?
Please help. This is really confusing me. Thanks.
athabasco sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: athabasco already gave sorinr points
@architchandra
A string that is added to the dom doesn't show surrounding quotes (first and last). Any quotes within the string (that are escaped) will be shown though.
architchandra sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 911 | @adityaparab |http://www.freecodecamp.com/adityaparab
#clickHere, #source, .safe1, .safe2{
cursor: pointer;
}
:star2: 1154 | @sorinr |http://www.freecodecamp.com/sorinr
fortmaximus sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
$('button[id^="id-"]').on('click'.....
so i would apply the event to any button that have an id starting with "id-"
mohammadhasham sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1155 | @sorinr |http://www.freecodecamp.com/sorinr
newline backslash
SecondLinebackslash carriage-return
ThirdLine
\n\\
@mml3b FirstLinenewline backslash
SecondLinebackslash carriage-return
ThirdLine
\
at the beginning
SecondLine
you are not adding backslash
myStr="FirstLine\n\\SecondLine\\\rThirdLine";
@mml3b FirstLinenewline backslash
SecondLinebackslash carriage-return
ThirdLine
@PRADEEPGUNDLURU This might be of some use
pradeepgundluru sends brownie points to @adityaparab :sparkles: :thumbsup: :sparkles:
:cookie: 915 | @adityaparab |http://www.freecodecamp.com/adityaparab
idoubtyoudlikeit sends brownie points to @chris10emery and @heydante :sparkles: :thumbsup: :sparkles:
:cookie: 120 | @chris10emery |http://www.freecodecamp.com/chris10emery
:cookie: 382 | @heydante |http://www.freecodecamp.com/heydante
if I delete this code in css: .video {
position: relative;
padding-bottom: 56.25%;
padding-top: 30px;
height: 0;
margin: 10px 0;
overflow: hidden;
}
.video iframe {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
}
luckyrabbits sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1738 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
@mml3b
var myStr="This is the first sentence.";
myStr += "This is the second sentence.";
next time read carefully - it's said over several lines
mml3b sends brownie points to @vasilebotnaru :sparkles: :thumbsup: :sparkles:
:cookie: 256 | @vasilebotnaru |http://www.freecodecamp.com/vasilebotnaru
:not
, something like:document.querySelector("div:not([your menu class name])").addEventListener('click', function() {//hide your dropdown})
mohammadhasham sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1449 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
$('.header').css('background-position', '0 ' + -currScrollPos/4 + 'px');
{
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
no-padding
class to the columns where you don't want padding and define .no-padding {padding: 0;}
in your CSS
remdata sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1450 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Can someone help me :P
http://codepen.io/Waqas909/pen/OWENwR?editors=1100
My Equal Button is pushing my other button downwards because in the HTML code, they come after the equal button.
How could I fix this? I know the problem, But is there a way to fix them from going downwards of the calculator?
center-block
class on the <img> element or put the <img> element in a <div> and use the text-center
class on the <div>
mx-auto d-block
on the <img> element
artoodeeto sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1451 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
display: inline-block
on all of your keys and then reduce the width of each of your keys to get them back to 4 per row.
.Key
class to all of your keys:.Key{
display: inline-block;
height: 50px;
width: 67px;
Okay, add a equals
class to the =
button and do this:
.equals {
position: absolute;
top: 205px;
left: 260px;
min-height: 115px;
}
@Waqas909
waqas909 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1452 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
.
button is a little off and the =
button is a little too wide, just by a few pixels
$('clickedElement').on('click', function() {
$('otherElement').append($(this).html());
});
freakishlancer sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1453 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
ikilpat sends brownie points to @taltmann42 :sparkles: :thumbsup: :sparkles:
:cookie: 455 | @taltmann42 |http://www.freecodecamp.com/taltmann42
.container
class instead of .container-fluid
- no need to specify a width in your CSS, it will automatically adjust for you based on screen size.
ikilpat sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1454 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
appendTo()
$(this).html()
append()
.attr()
etc. There has to be something I'm missing.
=>
notation for functions. This keeps the this
in the scope of where the function is called from. In your case, using an anonymous function would work better, because then this
refers to the actually clicked element
$("button:not(#calc-screen, .operation)").on("click", (e) => {
$('#calc-screen').append($(e.target).text())
});
this
.
freakishlancer sends brownie points to @taltmann42 and @tylermoeller :sparkles: :thumbsup: :sparkles:
:warning: freakishlancer already gave tylermoeller points
:cookie: 456 | @taltmann42 |http://www.freecodecamp.com/taltmann42
$(document).ready(() => {
$("button:not(#calc-screen, .operation)").on("click", function() {
$('#calc-screen').append($(this).text())
});
});
nav
tag, so the browser thinks all the content is inside that nav
nav
tag, not the content
artoodeeto sends brownie points to @taltmann42 :sparkles: :thumbsup: :sparkles:
:cookie: 457 | @taltmann42 |http://www.freecodecamp.com/taltmann42
var x=new Boolean('false');
if (x){
//code executed;
}
What is the point of Boolean object? I know it is a object wrapper for boolean value. But what does it mean?
artoodeeto sends brownie points to @taltmann42 :sparkles: :thumbsup: :sparkles:
:warning: artoodeeto already gave taltmann42 points
align-items
.wrapper {
height: 100vh;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
position: relative
in container div and position: absolute
in content div
height
property set to anything and that probably screwed me over.
freakishlancer sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1455 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
var x=Boolean(expression);//A
var x=new Boolean(expression);//B
What is the difference between A and B? Well, I know in B, var x is created as an instance of Boolean(expression). And (I am assuming) Boolean(expression) returns true(?). But what does each mean?
freakishlancer sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:warning: freakishlancer already gave tylermoeller points
Navigator.geolocation
. For that project, I used IPInfo.io for geolocation and APIXU for the weather API.
athabasco sends brownie points to @freakishlancer and @tylermoeller :sparkles: :thumbsup: :sparkles:
:cookie: 361 | @freakishlancer |http://www.freecodecamp.com/freakishlancer
:star2: 1456 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
Instead of this:
<button><a target="_blank" href="#portfolio"></a>Portfolio</button>
Just do:
<a class="btn btn-default" href="#portfolio">Portfolio</a>
<a target="_blank" class="btn btn-default" href="https://twitter.com/queensedeen">
<i class="fa fa-twitter-square"></i> Twitter
</a>
<a target="_blank" class="btn btn-default" href="https://www.linkedin.com/in/robin-kovzelove-b51b3515/">
<i class="fa fa-linkedin-square"></i> LinkedIn
</a>
<a class="btn btn-default" href="#about">About</a>
<a class="btn btn-default" href="#portfolio">Portfolio</a>
luckyrabbits sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1457 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
oh I would never :P haha
also I have no idea how to send brownie points for the help. This is my first time on the chat
ptarus sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1458 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
ptarus sends brownie points to @rav404 :sparkles: :thumbsup: :sparkles:
:cookie: 306 | @rav404 |http://www.freecodecamp.com/rav404