function getCount(str) {
var vowelsCount = 0;
str.split(' ')
switch (str){
case "a": vowelsCount + 1;
break;
case "e": vowelsCount + 1;
break;
case "i": vowelsCount + 1;
break;
case "o": vowelsCount + 1;
break;
case "u": vowelsCount + 1;
break;
};
return vowelsCount;
}
var arr = [
[0,0,0]
];
var x=[...arr, [1,1,1,]]
console.log(x)//[ [ 0, 0, 0 ], [ 1, 1, 1 ] ]
x[0][0]=1;
console.log(x)//[ [ 1, 0, 0 ], [ 1, 1, 1 ] ]
console.log(arr)//[ [ 1, 0, 0 ] ]---> why use spread operator, the arr element is still changed?
var arr = [
[0,0,0]
];
var x=arr.concat([[1,1,1]]);
console.log(x)//[ [ 0, 0, 0 ], [ 1, 1, 1 ] ]
x[0][0]=1;
console.log(x)//[ [ 1, 0, 0 ], [ 1, 1, 1 ] ]
console.log(arr)//[ [ 1, 0, 0 ] ]---> why use concat, the arr element is still changed?
str.split('')
instead. You could then to a str.split('').map to loop through the string and evaluate each character.
arr
changes when you're only updating x
?
why the original arr changes when you're only updating x?
:star2: 1388 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
c0d0er sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
var copyOfMyArray = myArray.slice(0);
function getCount(str) {
var sum=0
var i = str.split(");
switch (i){
case 'a': sum + 1;
break;
case 'e': sum +1;
break;
case 'i': sum + 1;
break;
case 'o': sum + 1;
break;
case 'u': sum + 1;
break;
};
return sum
}
c0d0er sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:warning: c0d0er already gave tylermoeller points
str.split('')
needs to be two apostrophes, not a double quote, for starters :)
str='hello world';
switch (['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']){
case 'a': sum + 1;
break;
case 'e': sum + 1;
break;
case 'i': sum + 1;
break;
case 'o': sum + 1;
break;
case 'u': sum + 1;
break;
};
str.split('')
if it's a vowel, add 1
statement.
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=i; x<str.length; x++){
return sum
}
str.split('').length
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i === 'a' || 'e' || 'i' || 'o' || 'u'){
return sum + 1;
};
};
return sum
}
i
equal?
if (i === 'a' || i === 'e' || etc...
return
will stop the for loop - so you just want to add, not return inside the loop
.includes()
I think? but I haven't used it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
mmgfrog sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1389 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i[0] === 'a'){
sum + 1;
} else if (i[3] === 'a'){
sum+1;
} else if (i[5] === 'a') {
sum + 1;
} else if (i[7] === 'a') {
sum + 1;
} else if (i[10] === 'a') {
sum + 1;
};
};
return sum;
}
https://twitter.com/intent/tweet?text=The text you want to tweet
sum++
or sum = sum + 1
rfried99 sends brownie points to @mmgfrog :sparkles: :thumbsup: :sparkles:
:cookie: 277 | @mmgfrog |http://www.freecodecamp.com/mmgfrog
abracadabra
and adding 1 every time because if (i[0] === 'a')
is true every time
if (i[x] === 'a' || i[x] === 'e' || i[x] === 'i' || i[x] === 'o' || i[x] === 'u') {
x
incrementing for you
@TylerMoeller function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i[x] === 'a' || i[x] === 'e' || i[x] === 'i' || i[x] === 'o' || i[x] === 'u'){
sum ++;
};
};
return sum;
}
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i[x] === 'a' || i[x] === 'e' || i[x] === 'i' || i[x] === 'o' || i[x] === 'u'){
sum ++;
};
};
return sum;
}
str.toLowerCase()
function getCount(str) {
return (str.match(/[aeiou]/ig)||[]).length;
}
This was my version:
function getCount(str) {
var vowelCount = 0;
str.split('').map(val => {if (val.match(/[aeiou]/i)) vowelCount++});
return vowelCount;
}
I like the one you gave better
ig
means ignore case and evaluate all characters in the string (g = global)
rfried99 sends brownie points to @luna9 :sparkles: :thumbsup: :sparkles:
:cookie: 119 | @luna9 |http://www.freecodecamp.com/luna9
transcurrido
div to be in the center of the circle? http://codepen.io/zarruk/pen/VPWrWL?editors=1010
function getCount(str) {
var sum=0
var i = str.split('');
for(var x=0; x<i.length; x++){
if (i[x] === 'a' || i[x] === 'e' || i[x] === 'i' || i[x] === 'o' || i[x] === 'u'){
sum ++;
};
};
return sum;
}
Instructions from your teacher:
Write a function called "countAllCharacters".
Given a string, "countAllCharacters" returns an object where each key is a character in the given string. The value of each key should be how many times each character appeared in the given string.
Notes:
* If given an empty string, countAllCharacters should return an empty object.
var output = countAllCharacters('banana');
console.log(output); // --> {b: 1, a: 3, n: 2}
Starter Code :
function countAllCharacters(str) {
// your code here
}
function countAllCharacters(str){
var i = str.split('')
var x = i.map(function(str){
})
return i
}
countAllCharacters('banana')
var string = 'banana';
function countAllCharacters(str) {
str.split('')
str.reduce(function(result, letter) {
var regex = new RegExp('[^' + letter + ']', 'g');
result[letter] = string.replace(regex, '').length;
return result;
}, {})
}
countAllCharacters(string)
var string = 'banana';
function countAllCharacters(str) {
return str.split('')
.reduce(function(result, letter) {
var regex = new RegExp('[^' + letter + ']', 'g');
result[letter] = string.replace(regex, '').length;
return result;
}, {})
}
countAllCharacters(string)
vanamove sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 877 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
function countAllCharacters(str) {
// your code here
var array = str.split("")
var object = {};
if(str.length === 0) return object;
else{
for(var i = 0; i < array.length; i++){
if(object[array[i]]) object[array[i]]++;
else object[array[i]] = 1;
}
return object;
}
}
var output = countAllCharacters('banana');
console.log(output);
checkForWinner() {
var combos = [[0,1,2], [0,3,6], [0,4,8], [1,4,7], [2,5,8], [2,4,6], [3,4,5], [6,7,8]]
combos.find(function(combo) {
if(this.state.board[combo[0]] !== "" && this.state.board[combo[0]] === this.state.board[combo[1]] && this.state.board[combo[1]] === this.state.board[combo[2]]) {
debugger
return this.state.board[combo[0]]
} else {
return false
}
}.bind(this))
}
componentDidUpdate() {
if (this.checkForWinner()) {
debugger
alert("winner!!")
}
}
return string.replace(/(.)(?=.*\1)/g, '')
.split('')
.reduce(function(result, letter) {
var regex = new RegExp('[^' + letter + ']', 'g');
result[letter] = string.replace(regex, '').length;
return result;
}, {})
function countAllCharacters(string){
return string.split('')
.reduce(function(result, letter) {
var regex = new RegExp('[^' + letter + ']', 'g');
result[letter] = string.replace(regex, '').length;
return result;
}, {})
}
countAllCharacters('banana')
johnnunns sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 878 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
Instructions from your teacher:
Write a function called "countWords".
Given a string, "countWords" returns an object where each key is a word in the given string, with its value being how many times that word appeared in th given string.
Notes:
* If given an empty string, it should return an empty object.
var output = countWords('ask a bunch get a bunch');
console.log(output); // --> {ask: 1, a: 2, bunch: 2, get: 1}
Starter Code :
function countWords(str) {
// your code here
}
function countWords(str) {
str.split(' ')
.reduce()
}
function countWords(str) {
str.split(' ')
.reduce(function(result, word){
var regex = new Regexp(/word/g)
},{})
return result
@johnnunns
g is global?
g
is global as in it will match all occurances. Otherwise, Reg Ex only matches first occurance.
@johnnunns
so that would only match one word
No. That will only match a string word
\w
or [A-Za-z]
w
in \w
should be small
W
like \W
will match nonword characters
var regex = new RegExp('(' + word + ')', 'g')
function countWords(str) {
str.split(' ')
.reduce(function(result, word){
var regex = new Regexp( '(' + word + ')', 'g')
},{})
return result
}
function countWords(str) {
str.split(' ')
.reduce(function(result, word){
var regex = new Regexp( '(' + word + ')', 'g');
result[word] = str.match(regex).length
return result;
},{})
}
countWords("hey whta updsls a dgfg s")
var regex = new RegExp('(' + word + ')', 'g'),
amount = str.match(regex).length,
output = amount < 2 ? amount :
word.length < 2 ? amount - 1 : amount;
function countWords(str) {
if(str.length===0){
return {};
}
return str.split(' ')
.reduce(function(result, word){
var regex = new RegExp( '(' + word + ')', 'g');
output = amount < 2 ? amount :
word.length < 2 ? amount - 1 : amount;
result[word] = output
return result;
},{})
}
countWords("ask a bunch get a bunch")
var output = $('.output');
output.empty();
output.append(
'<a href="wiki link">' +
'<h3>' + data.title + '</h3>' +
'<p>' + data.content + '</p>' +
'</a>'
);
amount = str.match(regex).length,
condition ? true : false
<div class="my-class row another-class one-more"></div>
aymohamed sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 879 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
fortmaximus sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 880 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
fortmaximus sends brownie points to @ritvarsz :sparkles: :thumbsup: :sparkles:
:cookie: 288 | @ritvarsz |http://www.freecodecamp.com/ritvarsz
return str ? result : {}
Hello everyone! Anyone out there could give a rather broad insight on how to approach building a website, a sort of landing page, in this manner?
http://www.buildinamsterdam.com/
The main features i'm intending to capture are the style of the page transitions.
I was refered I could approach this with Angular UI, but i'm looking for a second opinion
GET file://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css net::ERR_FILE_NOT_FOUND
Im getting these errors when I try to put a fontawesome icon in my website.. However I added the cdns provided in the head secton lie they tell me to.. How do i fix?
My code
<!DOCTYPE html>
<html>
<head>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
<title>Gallery</title>
</head>
:star2: 1133 | @sorinr |http://www.freecodecamp.com/sorinr
123xylem sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<title>Gallery</title>
</head>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" >
<style>
.fa fa-camera-retro{
width:30px;
height:20px;}
.standard{width: 100%;
height:200px;}
body{padding: 70px;}
.jumbotron{
background-color:#ccc;
color:#2c3e50;
}
.navbar-inverse{
background:#2c3e50;
}
.navbar-inverse .navbar-nav>.active>a, .navbar-inverse .navbar-nav>.active>a:focus, .navbar-inverse .navbar-nav>.active>a:hover{
background:#2c3e50;
}
}
.navbar-inverse .navbar-brand {
color: white;
}
.navbar-inverse .navbar-nav>li>a {
color: white;
}
</style>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"> <span class="glyphicon glyphicon-picture"></span> Images</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home <span class="sr-only">(current)</span></a></li>
<li><a href="#">Contact</a></li>
</ul>
<ul class="nav navbar-nav navbar-right active"> <li ><a href="#">Login </a></li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class="container">
<div class="jumbotron">
<h1> <i class="fa fa-camera-retro" aria-hidden="true"></i>
Image Gallery</h1>
</div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" </script>
<script src="https://maxcdn.bootstrapcdn.com/bootstr
rap/3.3.7/js/bootstrap.min.js"</script>
</body>
</html>
</head>
down to right before <body>
123xylem sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 746 | @alpox |http://www.freecodecamp.com/alpox
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
123xylem sends brownie points to @sorinr and @alpox :sparkles: :thumbsup: :sparkles:
:warning: 123xylem already gave alpox points
:warning: 123xylem already gave sorinr points
Using CSS
Copy the entire font-awesome directory into your project.
In the <head> of your html, reference the location to your font-awesome.min.css.
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
Check out the examples to start using Font Awesome!
THATS WHAT I COPIED
riccardompesce sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 747 | @alpox |http://www.freecodecamp.com/alpox
vasilebotnaru sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 748 | @alpox |http://www.freecodecamp.com/alpox
html
, body
, head
tags from the html and put everything what was in head
in the settings under stuff for head
What i see it that you mix quite some bootstrap and your own css @VasileBotnaru
If you want to go with bootstrap, you should probably stick to their exact rules and elements which work together. (It doesn't like mixes)
If you want to go with your own css (Makes your page more unique), you should better take out bootstrap and don't use their elements
row
- The next inner element should always be a col-x-x
(Some column)
ul li {
list-style-type: none; // No bullet points
display: inline-block; // Show horizontally
}
vasilebotnaru sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:warning: vasilebotnaru already gave alpox points
someDOMObject.addEventListener("keypress", function() { ... });
someDOMObject.addEventListener("keypress", function(keyEvent) {
if(keyEvent.key === 'a') {
// Key a is pressed
}
});
mohammadhasham sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:cookie: 749 | @alpox |http://www.freecodecamp.com/alpox
mohammadhasham sends brownie points to @alpox :sparkles: :thumbsup: :sparkles:
:warning: mohammadhasham already gave alpox points
shadow032 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1134 | @sorinr |http://www.freecodecamp.com/sorinr
dgriffin123 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1135 | @sorinr |http://www.freecodecamp.com/sorinr
dgriffin123 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:warning: dgriffin123 already gave sorinr points
<p onclick = "name()" id="para">
Hello
</p>
$(document).ready(function(){
function name(){
document.getElementById("para").innerHTML = "wow";
}
});
mohammadhasham sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1136 | @sorinr |http://www.freecodecamp.com/sorinr
:star2: 1137 | @sorinr |http://www.freecodecamp.com/sorinr
sbxn14 sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1138 | @sorinr |http://www.freecodecamp.com/sorinr
bwongcodes sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
var key = document.querySelector("audio[data-key=${x}]");
<audio data-key="65" src="E:\Web Development\Javascript 30\Drumkit Challenge\boom.wav"></audio>
x
a variable?
/** Javascript File **/
document.addEventListener("keydown",function(x){
var key = document.querySelector("audio[data-key=x]");
console.log(key);
});
@oppiniated
"
with the `
$('#search-bar').bind("enterKey",function(e){
$('#random-button').fadeOut("slow");
$( '#search-bar').animate({
top: "-200px"
}, 1000, function() {
// Animation complete.
});
});
$('#search-bar').keyup(function(e){
// if enter is pressed
if(e.keyCode == 13)
{
$(this).trigger("enterKey");
}
});
instead of
"` for it
var key = document.querySelector(`audio[data-key=${x}]`);
var key = document.querySelector("audio[data-key='${x}']");
mohammadhasham sends brownie points to @oppiniated and @sorinr :sparkles: :thumbsup: :sparkles:
:cookie: 520 | @oppiniated |http://www.freecodecamp.com/oppiniated
:star2: 1139 | @sorinr |http://www.freecodecamp.com/sorinr
nathandim sends brownie points to @jaanhio :sparkles: :thumbsup: :sparkles:
:cookie: 120 | @jaanhio |http://www.freecodecamp.com/jaanhio
nathandim sends brownie points to @sorinr :sparkles: :thumbsup: :sparkles:
:star2: 1140 | @sorinr |http://www.freecodecamp.com/sorinr
// Setup
var testString = "There are 3 cats but 4 dogs.";
// Only change code below this line.
var expression = /\d+/g; // Change this line
// Only change code above this line
// This code counts the matches of expression in testString
var digitCount = testString.match(expression).length;
Why is the test returning 2? Does /\d+/g
count the # of numbers in testString?
joshuapsteele sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1390 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
@joshuapsteele Happy to help! Good luck :+1:
I find this to be a good outline for the portfolio:
<header>
<nav></nav>
</header>
<main>
<section></section>
<section></section>
<section></section>
</main>
<footer></footer>
The nav can also go above the <header> if you want it fixed to the top of your page.
function countAllCharacters(string) {
var charCount = {};
string.split('').map(val => {
charCount[val] = (charCount[val] || 0) + 1;
});
return charCount;
}
yonichanowitz sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1393 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
yonichanowitz sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 881 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
@kevnbot , i'm just thinking here, maybe
https://dev.twitter.com/web/tweet-button/parameters
the parameter data-text=
followed by a variable that you assign as the current quote with some javascript? i don't know , im up to where you are
@jdtdesigns like everything in life.
i'm burnt out already, but i keep on pushing because i have to make more money, and i have a family to feed.
hello dear campers, can any one tell me why even padding-top: 1px causes overlapping in dynamically generated divs. I am .article class in them like this
.article {
background-color: #bcc6cc;
padding-left: 15px;
padding-bottom: 5px;
/*padding-top: 1px;*/
padding-right: 15px;
}
and here is my pen https://codepen.io/ghulamshabir/pen/vXELwL?editors=0000
sbxn14 sends brownie points to @kirbyedy :sparkles: :thumbsup: :sparkles:
:star2: 1702 | @kirbyedy |http://www.freecodecamp.com/kirbyedy
ghulamshabir sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1395 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
.article {
margin-bottom: 10px;
}
@ghulamshabir Also, this line:
$('#wiki').append($('<div class="article"><h2>'+pages[i].title+"</h2><p>"+pages[i].extract+"</p>"));
doesn't need the $(
in it and it's missing a closing </div>
$('#wiki').append(
`<div class="article">
<h2>${pages[i].title}</h2>
<p>${pages[i].extract}</p>
</div>`
);
ghulamshabir sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:cookie: 882 | @jdtdesigns |http://www.freecodecamp.com/jdtdesigns
ghulamshabir sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:warning: ghulamshabir already gave jdtdesigns points
ghulamshabir sends brownie points to @jdtdesigns :sparkles: :thumbsup: :sparkles:
:warning: ghulamshabir already gave jdtdesigns points
GET
ing a JSON API. I get this as part of my response."weather":[{"id":804,"main":"clouds","description":"overcast clouds","icon":"04n"}],
div id="menu">
<ul>
<li>Solucoes</li>
<li>Internet</li>
<li>Voz</li>
<li>Suporte</li>
<li>Loja</li>
</ul>
</div>
<!DOCTYPE html>
<html>
<head>
<title>EBU PAGE</title>
</head>
<body>
<div id="menu">
<ul>
<li>Solucoes</li>
<li>Internet</li>
<li>Voz</li>
<li>Suporte</li>
<li>Loja</li>
</ul>
</div>
</body>
</html>
this is not displaying the content in horizontal way why
mortiferr sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1396 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
if-then
statement that writes a different character based on a variable. Why isn't it printing to the page?
copy property path
index.html:20 Uncaught ReferenceError: units is not defined
at index.html:20
<div id="menu">
<ul>
Solucoes
Internet
Voz
Suporte
Loja
</ul>
adrianwarholm sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1397 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
<div id=" menu ">
Solucoes
Internet
Voz
Suporte
Loja
</div>
Solucoes Internet Voz Suporte Loja
aymohamed sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1398 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
So since I don't really understand the basic CSS grid/ layout system, I decided to try and build a simple header-main-sidebar-footer type of layout.
So I tried following this: http://vanseodesign.com/css/2-column-layout-code/
I tried building it again by myself this time, and this is for far I got:
https://codepen.io/CMYK/pen/zNdvwM?editors=1100
Why in the world does my main section overlap like that over the header section?
#
in it. Also, your button ID does not match the ID used in your jQuery. Fix those issues, and your quotes should work.
casdidier sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1399 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
``
@Josie-N One small typo here:
<div id="header">
<div id="nav"></nav>
</div>
Take note of the opening/closing tags
```
$(document).ready(function() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
$("#latlon").html(position.coords.latitude + " " + position.coords.longitude);
});
}
```
I'm doing the weather challenge on codepen but even this code doesnt output anything, what am I doing wrong?
$(document).ready(function() {
// var lat;
// var lon;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
//lat = position.coords.latitude;
//lon = position.coords.longitude;
$("#latlon").html(position.coords.latitude + " " + position.coords.longitude);
});
}
toffanelly sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1400 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
$("#search").submit(function(e) {
e.preventDefault();
jumpship91 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1401 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
jumpship91 sends brownie points to @johnnybizzel :sparkles: :thumbsup: :sparkles:
:star2: 1182 | @johnnybizzel |http://www.freecodecamp.com/johnnybizzel
:warning: jumpship91 already gave tylermoeller points
jumpship91 sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
:star2: 1402 | @tylermoeller |http://www.freecodecamp.com/tylermoeller
josie-n sends brownie points to @tylermoeller :sparkles: :thumbsup: :sparkles:
navigator.geolocation.getCurrentPosition(function(position) {
lat = position.coords.latitude;
lon = position.coords.longitude;
var latInteger = Math.round(lat);
var lonInteger = Math.round(lon);
$("#latlon").html(lat + " " + lon);
var address = "api.openweathermap.org/data/2.5/weather?lat=" + latInteger + "&lon=" + lonInteger + "&APPID=a75682a6c2b68e86092711fc2e591d34";
$("#address").html(address);
$.getJSON(address, function (json) {
$("#json").html(JSON.stringify(json));
});
});
I'm here again. Basically instead of getting the json object printed on screen i get nothing. The console outputs error 404 (in particular "Failed to load resource: the server responded with a status of 404 ()"). The address of the api is working because if i open it in another tab i get the object i need. Im clueless really
font-family: lobster;
so like this
<head><style src ="https://use.fontawesome.com/3b619cadbf.js"><style> ?
body {
font-family: lobster; }
@nikkilr88 codepen? I am just starting the section. It was talking about how to use bootstrap in your project.