mojoe13 sends brownie points to @waqas909 :sparkles: :thumbsup: :sparkles:
:warning: mojoe13 already gave waqas909 points
volkranium sends brownie points to @waqas909 :sparkles: :thumbsup: :sparkles:
:cookie: 280 | @waqas909 |http://www.freecodecamp.com/waqas909
volkranium sends brownie points to @dennistalmid :sparkles: :thumbsup: :sparkles:
:cookie: 126 | @dennistalmid |http://www.freecodecamp.com/dennistalmid
dennistalmid sends brownie points to @volkranium :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for volkranium
volkranium sends brownie points to @waqas909 and @dennistalmid :sparkles: :thumbsup: :sparkles:
:warning: volkranium already gave waqas909 points
:warning: volkranium already gave dennistalmid points
:warning: could not find receiver for volkranium
waqas909 sends brownie points to @volkranium :sparkles: :thumbsup: :sparkles:
var me = "hello";
var text = "hello world";
var answer = text.replace(me);
.section-showcase {
height: $showcase-height;
text-align: center;
background-color: whitesmoke;
margin-bottom: 0;
background-image: url(../../img/showcase.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
h2 {
margin-top: 20%;
margin-bottom: 20px;
font-size: 4em;
text-shadow: 2px 2px #ffffff;
color: $primary;
}
p {
color: white;
text-shadow: 1px 1px $primary;
}
}
@volkranium
background-image: url(../../img/showcase.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
so basically this is what you want to ctrl+c :)
var me = "hello";
var text = "hello world";
var answer = text.replace(me);
function destroyer(arr) {
// Remove all the values
var arr1 = "";
for(var i = 0; i < arguments.length; i++){
arr1 = arguments[0[i]].replace(arguments[i], "");
}
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
@DennisTalmid
according to the syntax:
you should do:
yourArray.filter(destroyer([1, 2, 3, 1, 2, 3], 2, 3));
Or somehting similar, I am sorry I didn´t read the challenge, but in general this would be the apporach if I am not mistaken
and if you want to replace the removed values with " " for example, you do:
var arr1 =" ";
yourArray.filter(destroyer([1, 2, 3, 1, 2, 3], 2, 3),arr1);
arr1 = arguments[0[i]].replace(arguments[i], ""); // you can't access arrays like this.
you need to use arguments[0][i]
function destroyer(arr)
Your input name is arr
And you use "argument" instead
arguments.length
replace is a string method. It would work with what Im trying to do
I think the problem is
~~~
function destroyer(arr)
Your input name is arr
And you use "argument" instead
arguments.length
~~~
"Replace is a string method" means that you can use .replace on variables that are not strings
cant*
and your input is numbers
_> Took you a while to read my comment xD
jdc101214 sends brownie points to @waqas909 and @dennistalmid :sparkles: :thumbsup: :sparkles:
:cookie: 127 | @dennistalmid |http://www.freecodecamp.com/dennistalmid
:cookie: 281 | @waqas909 |http://www.freecodecamp.com/waqas909
function destroyer(arr) {
var args = Array.prototype.slice.call(arguments);
args.splice(0, 1);
return arr.filter(function(element) {
return args.indexOf(element) === -1;
});
}
I know this code (<img src="my-image.png" alt="My Image">) will work for adding images to my tribute page using bootstrap. But I have some really dumb questions.
When getting an image offline do I just copy and past the image url into the quotations?
Can I pull an image from my computer?
If I can't pull an image from my computer, but want to use one I have do I just post that image online?
If I pull offline do I use the <a href="http://website.com">
Unfortunately, you can't pull it directly from your computer. You have to upload it an image website. When it is done uploading, right click it and click "Open image in a new tab", copy paste the address and use it for <img src="Your address link from the image u just copied">
Oh btw There are no dumb questions :-)
Hope it was clear. Sorry I could have structured my answer better!
Oh Extra Information. Bootstrap is a framework. So for your tribute page, make sure to add it in the settings --> CSS --> Quick Add.
bearswamppastor sends brownie points to @waqas909 :sparkles: :thumbsup: :sparkles:
:cookie: 282 | @waqas909 |http://www.freecodecamp.com/waqas909
function getIndexToIns(arr, num) {
// Find my place in this sorted array.
var arr1 = arr.sort(function(a, b){return a-b;});
var arr2 = "";
for(var i = 0; i < arr.length; i++){
if(num < arr1[i]){
arr2 = arr1.unshift(num);
return i;
}
}
}
getIndexToIns([40, 60], 50);
Why is this code not working?
bomholt sends brownie points to @anony456 :sparkles: :thumbsup: :sparkles:
:cookie: 36 | @anony456 |http://www.freecodecamp.com/anony456
bomholt sends brownie points to @anony456 :sparkles: :thumbsup: :sparkles:
:warning: bomholt already gave anony456 points
jameshaengsin sends brownie points to @bomholt :sparkles: :thumbsup: :sparkles:
:cookie: 558 | @bomholt |http://www.freecodecamp.com/bomholt
target="_blank"
c0d0er sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1165 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
eadc-p sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 415 | @mot01 |http://www.freecodecamp.com/mot01
eadc-p sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:warning: eadc-p already gave mot01 points
Setup your fonts folder on the same level as your css folder, where bootstrap is located, and put the glyphicon fonts there. Then find the following lines in your bootstrap css file and make sure they also point to the font folder.
sorry c0d0er, you can't send brownie points to yourself! :sparkles: :sparkles:
if(weatherobject.temp > 90) {
$(".weatherimage").attr(src, "hoticon.jpg");
}
<a href="help.html">HELP!</a>
ul{display: block;margin-left:50%;transform: translate(-50%);}
@sorinr so use this code:
<div class="row">
<div class="col-xs-6"><div class="well"></div>
</div>
<div class="col-xs-6"><div class="well"></div>
</div>
</div>
adamfaraj sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 959 | @sorinr |http://www.freecodecamp.com/sorinr
hey any can look into my code and help me to add variable strTemp in get link in ajax
$(document).ready(function() {
$("#seabtn").click(function() {
var strTemp=$("#searchfield").val();
console.log(strTemp);
$.getJSON('http://api.openweathermap.org/data/2.5/weather?q=+strTemp&appid=869e6fd2f6e579ae650d308cb7f62cb4', function(str) {
console.log(str);
/*optional stuff to do after success */
$("#text2change").html(str.coord.lon);
});
});
});
i need help.
in the url link
'http://api.openweathermap.org/data/2.5/weather?q='+strTemp+'&appid=869e6fd2f6e579ae650d308cb7f62cb4'
bitian1506 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 960 | @sorinr |http://www.freecodecamp.com/sorinr
c0d0er sends brownie points to @0x0936 :sparkles: :thumbsup: :sparkles:
:star2: 2107 | @0x0936 |http://www.freecodecamp.com/0x0936
.replace(/[aeiou]/ig,'')
i know that this removes the vowels of a string. But what exactly every "character" in there means? thank you :)
// Prepend https:// to codepen url in order for navigator.geolocation to work
$(document).ready(function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var lat = position.coords.latitude;
var lon = position.coords.longitude;
var url = "https://api.darksky.net/forecast/myapikey/" + lat + "," + lon;
$.ajax({
type: 'GET',
url: url,
dataType: "jsonp",
success: function(data) {
var country = data.timezone.replace("/", ", ");
var dailySummary = data.daily.summary;
var fahrenheit = Math.round(data.currently.temperature);
var celsius = Math.round((fahrenheit - 32) * (5 / 9));
$(".info").html("<p>" + country + "</p><p>" + dailySummary + "<canvas id='icon' width='128' height='128'></canvas>" + "</p><p class='celsius'>" + celsius + "</p><p class='fahrenheit hide'>" + fahrenheit + "</p>" + "<p class='degree'>" + "°F" + "</p>");
var skycons = new Skycons({"color": "pink"});
var icon = data.currently.icon;
skycons.add("icon", Skycons.icon);
skycons.play();
}
});
});
}
});
$(document).ready(function() {
$("#seabtn").keypress(function(e)
{
var key=e.which;
if(key == 13){
var strTemp = $("#searchfield").val();
console.log(strTemp);
$.getJSON('http://api.openweathermap.org/data/2.5/weather?q=' + strTemp + '&appid=869e6fd2f6e579ae650d308cb7f62cb4', function(str) {
console.log(str);
/*optional stuff to do after success */
$("#text2change").html("LOCATION:" + str.name + "</br>" + "Latitude:" + str.coord.lat + "</br>" + "Longitude:" + str.coord.lon + "</br>" + "TEMP:" + str.main.temp + "</br>" + "PRESSURE:" + str.main.pressure + "</br>" + "MIN TEMP:" + str.main.temp_min + "</br>" + "MAX TEMP:" + str.main.temp_max + "</br>");
});
}
});
});
inci-august sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 963 | @sorinr |http://www.freecodecamp.com/sorinr
saylos sends brownie points to @jluboff and @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 496 | @jluboff |http://www.freecodecamp.com/jluboff
:cookie: 964 | @sorinr |http://www.freecodecamp.com/sorinr
$(document).ready(function(){
var location;
$.getJSON("http://ip-api.com/json", function(json){
location = json.city;
var country = json.country;
$("#Location").html("<p>"+location+", "+country+"</p>");
});
$.getJSON("http://api.openweathermap.org/data/2.5/weather?q="+location, function(json){
$("#Weather").html("<p>"+json.description+"</p>");
});
});
$(document).ready(function(){
var location;
$.getJSON("http://ip-api.com/json", function(json){
location = json.city;
$.getJSON("http://api.openweathermap.org/data/2.5/weather?q="+location, function(json){
$("#Weather").html("<p>"+json.description+"</p>");
});
console.log(location);
var country = json.country;
$("#Location").html("<p>"+location+", "+country+"</p>");
});
});
:cookie: 363 | @makkbit |http://www.freecodecamp.com/makkbit
:warning: saylos already gave sorinr points
saylos sends brownie points to @makkbit and @sorinr :sparkles: :thumbsup: :sparkles:
can you please help with this:
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
my code is not passing any test
here is the code:
```function destroyer(arr) {
// Remove all the values
var newArr = arr.filter(function(val) {
for(i = 1; i < arguments.length; i++) {
return val !== arguments[i];
}
});
return newArr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
```
the test
destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
destroyer([2, 3, 2, 3], 2, 3) should return [].
destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].
can you please help with this:
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
my code is not passing any test
here is the code:
```function destroyer(arr) {
// Remove all the values
var newArr = arr.filter(function(val) {
for(i = 1; i < arguments.length; i++) {
return val !== arguments[i];
}
});
return newArr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
```
the test
destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
destroyer([2, 3, 2, 3], 2, 3) should return [].
destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].
can you please help with this:
You will be provided with an initial array (the first argument in the destroyer function), followed by one or more arguments. Remove all elements from the initial array that are of the same value as these arguments.
my code is not passing any test
here is the code:
function destroyer(arr) {
// Remove all the values
var newArr = arr.filter(function(val) {
for(i = 1; i < arguments.length; i++) {
return val !== arguments[i];
}
});
return newArr;
}
destroyer([1, 2, 3, 1, 2, 3], 2, 3);
the test
destroyer([1, 2, 3, 1, 2, 3], 2, 3) should return [1, 1].
destroyer([1, 2, 3, 5, 1, 2, 3], 2, 3) should return [1, 5, 1].
destroyer([3, 5, 1, 2, 2], 2, 3, 5) should return [1].
destroyer([2, 3, 2, 3], 2, 3) should return [].
destroyer(["tree", "hamburger", 53], "tree", 53) should return ["hamburger"].
var args = Array.prototype.slice.call(arguments);
<button onClick="searchForArticle" class="fa fa-search fa-lg" aria-hidden="true">search<button>
</button>
diederikquak sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 365 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
margin-top
to the row with the text
<div class = "row" style="margin-top:50px;">
$.ajax({
'url': '//en.wikipedia.org/w/api.php',
'dataType': 'jsonp',
'data': {
'action': 'opensearch',
'search': encodeURIComponent($('.search-input').val()),
'limit': 'max',
'namespace' : '0',
'format': 'json',
'success': function(data) {
console.log(data);
},
'error': function() {
}
}
});
// in browser's developer tools i can see the JSON response received, but console.log(data) is giving me undefined. How is this the case?
purpose50 sends brownie points to @makkbit :sparkles: :thumbsup: :sparkles:
:cookie: 364 | @makkbit |http://www.freecodecamp.com/makkbit
volkranium sends brownie points to @dennistalmid :sparkles: :thumbsup: :sparkles:
:cookie: 129 | @dennistalmid |http://www.freecodecamp.com/dennistalmid
function transformTypedCharacter(typedChar) {
var code = typedChar.keyCode;
if(typedChar == "a") {
return typedChar = "b";
}
else if(typedChar == "q") {
return typedChar = 7;
}
else if(typedChar == "b") {
return typedChar = 9;
}
else if(code === 51) {
typedChar.preventDefault();
return typedChar = 1;
}
else {
return typedChar;
}
}
:cookie: 392 | @kazzacarrot |http://www.freecodecamp.com/kazzacarrot
bobbawoolf sends brownie points to @callumquick and @kazzacarrot :sparkles: :thumbsup: :sparkles:
:cookie: 312 | @callumquick |http://www.freecodecamp.com/callumquick
waqas909 sends brownie points to @mot01 :sparkles: :thumbsup: :sparkles:
:cookie: 416 | @mot01 |http://www.freecodecamp.com/mot01
hii.. can anybody plzz help me with my portfolio project....
code: <div style="position:fixed; background:silver; width:100%">
<div class="row">
<div class="col-xs-4 "> <button id="button1" class="btn btn-block btn-primary">About</button></div>
<div class="col-xs-4 "> <button id="button1" class="btn btn-block btn-primary">Portfolio</button></div>
<div class="col-xs-4 "> <button id="button1" class="btn btn-block btn-primary">Contact</button></div>
</div>
var arr1 = [2,3,4, 5, 6,4, 7];
var arr2 = [2,3];
i want to write a function that will fetch every element from arr1 and then check if that element is present in arr2 if present it should return true
so in this case it should return true two times as both elements are present in arr1.
@callumquick
i tried
var arr1 = [2,3,4,5,6,4,7];
var arr2 = [2,3];
for(var i = 0; i < arr1.length; i++) {
for(var k = i + 1; k < arr2.length; k++) {
console.log(arr1[i].includes(arr2[k]));
arr1.includes(arr2);
}
}
but got this error
Uncaught TypeError: arr1[i].includes is not a function
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
</button>
can anyone explain me in the snipped what does this "collapsed" class do. I searched a lot but couldn't find this class. I could find the class "collapse" and related classed but couldn't find "collapsed". Is it a typo or am I missing something. Please help!
@Mr-Kumar-Abhishek Hi, I stumbled upon this snippet while searching ```
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
</button>``` can anyone explain me in the snipped what does this "collapsed" class do. I searched a lot but couldn't find this class. I could find the class "collapse" and related classed but couldn't find "collapsed". Is it a typo or am I missing something. Please help!
roastedchicken sends brownie points to @mr-kumar-abhishek :sparkles: :thumbsup: :sparkles:
:cookie: 454 | @mr-kumar-abhishek |http://www.freecodecamp.com/mr-kumar-abhishek
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i> </button>
can anyone explain me in the snippet what does this "collapsed" class do. I searched a lot but couldn't find this class. I could find the class "collapse" and related classed but couldn't find "collapsed". Is it a typo or am I missing something?Please help!
hi guys
any help with this please
One of the simplest and most widely known ciphers is a Caesar cipher, also known as a shift cipher. In a shift cipher the meanings of the letters are shifted by some set amount.
A common modern use is the ROT13 cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.
Write a function which takes a ROT13 encoded string as input and returns a decoded string.
All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.
here is my code:
function rot13(str) { // LBH QVQ VG!
var newStr = "";
for(i = 0; i < str.length; i++) {
var strVal = str[0];
if(strVal !== " ") {
var charValue = str.charCodeAt(i);
charValue-=13;
var fCharValue = String.fromCharCode(charValue);
newStr+=fCharValue;
}else {
newStr+= " ";
}
}
return newStr;
}
// Change the inputs below to test
rot13("SERR PBQR PNZC");
the test that should be passed:
rot13("SERR PBQR PNZC") should decode to "FREE CODE CAMP"
rot13("SERR CVMMN!") should decode to "FREE PIZZA!"
rot13("SERR YBIR?") should decode to "FREE LOVE?"
rot13("GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.") should decode to "THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX."
what i got for the first test:
F8EE C5DE CAM6
please what am i doing wrong and what should i do?
_
casadin sends brownie points to @gastrogeek :sparkles: :thumbsup: :sparkles:
:warning: could not find receiver for gastrogeek
apoorv-mishra sends brownie points to @nitinnair89 :sparkles: :thumbsup: :sparkles:
:cookie: 366 | @nitinnair89 |http://www.freecodecamp.com/nitinnair89
purpose50 sends brownie points to @mr-kumar-abhishek :sparkles: :thumbsup: :sparkles:
:cookie: 455 | @mr-kumar-abhishek |http://www.freecodecamp.com/mr-kumar-abhishek
if(code == 51) { //If 3
ev.preventDefault();
var inputNumber = "1"; //then 1
adder (inputNumber);
placeCaretAtEnd(this);
last.remove();
}
else if(code == 52) { //If 4
var inputNumber = "2"; //then 2
adder (inputNumber);
placeCaretAtEnd(this);
}
else if (code == 53) { //If 5
var inputNumber = "3"; //then 3
adder (inputNumber);
placeCaretAtEnd(this);
I have a problem, and no it cant be solved with ev.preventDefault();inputNumber
outside the scope of if - else statements. ~
float: center;
.... and yes there is a way to adjust them the way you want but it will not be done through textalign
<div class='clearfix'></div>
or add a division whose class is having float: clear;
clear: both;
I forgot :p
playingwithinfinity sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1166 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
<style>
.text-center {
text-align: center
}
</style>
<div class="container-fluid">
<h2 class="red-text" "text-center">CatPhotoApp</h2>
</div>
vengal4327 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1167 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
text-center is not working
that was it. thanks
@cli53 you can try:
nav ul{
text-align: left;
}
if this is what u want
<ul>
<li><a class="active" href="#home">Home</a></li>
<li class="active"><a href="#About"><span>About</span></a>
<li><a href="#Pictures">Pictures</a></li>
<li><a href="#Contact">Contact</a></li>
</ul> My navigation bar isn't working
background-color: orange
height: 50px
jichoat sends brownie points to @amidzicigor :sparkles: :thumbsup: :sparkles:
:cookie: 58 | @amidzicigor |http://www.freecodecamp.com/amidzicigor
jichoat sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 966 | @sorinr |http://www.freecodecamp.com/sorinr
amidzicigor sends brownie points to @jichoat :sparkles: :thumbsup: :sparkles:
:cookie: 118 | @jichoat |http://www.freecodecamp.com/jichoat
bobbawoolf sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 967 | @sorinr |http://www.freecodecamp.com/sorinr
@sorinr <ul>
<div id="Home">
<div id="About">
<div id="Pictures">
<div id="Contact">
<li><a class="active" href="#home">Home</a></li>
<li class="active"><a href="#About">About</a>
<li class="active"><a href="#Pictures">Pictures</a></li>
<li class="active"><a href="#Contact">Contact</a></li>
</ul>
</div>
</div>
</div>
</div> I've done what you said still not working :/ I want it to. Take me to the place I click on the page if you know what i mean
html
Hi, I found this code while searching
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> Menu <i class="fa fa-bars"></i>
</button>
I wanted to know what's the use of collapsed
in class="navbar-toggle collapsed"
. I searched and found the class collapse
, but couldn't find anything about collapsed
. Am I missing something or it is just a typo? Please help!
bobbawoolf sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: bobbawoolf already gave sorinr points
why does my code open a new window with the same url as the url of the code?
my html:
<a href="#" target="blank"><button onClick="randomArticle()" id id="link">Click here for a random article</a>
and javascript:
function randomArticle() {
var a = document.getElementById("link");
a.target = "blank";
a.href = "https://en.wikipedia.org/wiki/Special:Random";
}
:cookie: 968 | @sorinr |http://www.freecodecamp.com/sorinr
diederikquak sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
<button onClick="randomArticle()" id="link">Click here for a random article</button>
function randomArticle() {
window.open("https://en.wikipedia.org/wiki/Special:Random");
}
diederikquak sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: diederikquak already gave sorinr points
<button onClick="window.open('https://en.wikipedia.org/wiki/Special:Random');" id="link">Click here for a random article</button>
$(document).ready(function() {
$("#about-nav").click(function(){
var myIds = ["home", "about-nav", "port-nav", "contact-nav"];
for (i=0; i<myIds.length; i++)
{
var string = "#" + myIds[i];
if($(string).hasClass("active") && string !== this)
{
$(document).getElementById(myIds[i]).removeClass("active");
$(this).addClass("active");
}
}
});
});
refer to the parentelement with
var x = document.getElementById("link").parentElement
?
if($(string).hasClass("active") && string !== this)
not sure when this is true
==
operator which does an un-strict comparison so 12 == "12"
would result in a truthy value.===
operator, you do a strict comparison where 12 === "12"
results in a falsy value, whereas 12 === 12
is true.this
is as @sorinr pointed out, an object and not a string. A string and an object are always incomparable.