mananshah51 sends brownie points to @andrewmedhurst :sparkles: :thumbsup: :sparkles:
:cookie: 301 | @andrewmedhurst |http://www.freecodecamp.org/andrewmedhurst
and person1 made ,
name : "foo",
age:
left age empty
person 2 made ,
name: ,
age: 30
typed age but left name empty,
both are making progress in a same file but with different commits, how can i merge them?
so in the end there will be
const user = (props) =>{
name: "foo",
age:30
}
for the app.js file
your feedback on my projects is highly appreciated
pomodoro:
https://codepen.io/MG2016/full/paqyLm/
calculator:
https://codepen.io/MG2016/full/JprGGg/
weather app
https://codepen.io/MG2016/full/WXGvNm/
u mean like
var count = 0;
function addCount (){
count++;
}
?
muhamed2017 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2407 | @darrenfj |http://www.freecodecamp.org/darrenfj
muhamed2017 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9037 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
muhamed2017 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
var count = 0;
function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count = count + 1;
break;
}
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(2); cc(3); cc(7); cc('K'); cc('A');
I am trying to solve the Counting Card Problems (https://www.freecodecamp.org/challenges/counting-cards)
- <p> foo : </p>
+ <p>foo : {props.foo} </p>
- <p> bar : </p>
+ <p> bar : {props.bar} </p>
git merge
twice
var count
and string = "Hold"
mananshah51 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9038 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
muhamed2017 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
wackyjoker sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9039 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
muhamed2017 sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
abrism sends brownie points to @lydatech :sparkles: :thumbsup: :sparkles:
:star2: 2670 | @lydatech |http://www.freecodecamp.org/lydatech
@padunk not much. here's what i have so far:
function findLongestWord(str){
str = str.split(' ');
for(var i = 0; i < str.length; i++) {
}
} return longest;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
function findLongestWord(str){
str = str.split(' ');
for(var i = 0; i < str.length; i++) {
}
} return longest;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
use triple backticks @rrspence
```function findLongestWord(str){
str = str.split(' ');
var longestString;
for(var i = 0; i < str.length; i++) {
if(str[i].length >= longestString) {
longestString = str[i].length;
}
} return longestString;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
function findLongestWord(str){
str = str.split(' ');
var longestString;
for(var i = 0; i < str.length; i++) {
if(str[i].length >= longestString) {
longestString = str[i].length;
}
} return longestString;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
longestString
is undefined; you need to define it to a number
function findLongestWord(str){
str = str.split(' ');
var longestString = 0;
for(var i = 0; i < str.length; i++) {
if(str[i].length >= longestString) {
longestString = str[i].length;
}
} return longestString;
}
findLongestWord("The quick brown fox jumped over the lazy dog");
>=
?
.sort
or .reduce
or .map
mgrienauer sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 484 | @ezioda004 |http://www.freecodecamp.org/ezioda004
the-seth sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 9041 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
codernewby sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2408 | @darrenfj |http://www.freecodecamp.org/darrenfj
/**/ typeof === 'function' && ({"stream":{"_id":27756248656,"game
grid-columns
CSS property, complaining about "Unknown property name"... Also your navbar links don't seem to be working, but it doesn't look like you have the ID attributes set on the sections?
grid-column
value of 1fr
. Hmmm, and maybe the other grid-columns
that it's complaining about should be grid-column
?
}
at the bottom of your CSS section?
mgrienauer sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
.project > img
selector, then it displays the images on Chrome in the projects section.
mgrienauer sends brownie points to @khaduch :sparkles: :thumbsup: :sparkles:
:star2: 3763 | @khaduch |http://www.freecodecamp.org/khaduch
display: grid
for the .contact-form
...
justify-content: center;
and that made it occupy the full width? Well, the full width of 90%, the wrapping div's width.
clearAll
that clear items. The thing is, if user clicks clear
button each item disappears, but then if add item, all cleared items pop up again, I think the problem is inside clearAll
function, dont know how to fix ititems
variable and not local storage so you aren't removing the items when you clearAll
localStorage.removeItem('items');
doesnt remove items from localstorage,?
var count = 0;
function cc(card) {
// Only change code below this line
switch(card){
case 2:
case 3:
case 4:
case 5:
case 6:
count = count + 1;
return (count +' '+ "Bet");
case 7:
case 8:
case 9:
count = count + 0;
return (count +' '+ "Hold");
case 10:
case 'J':
case 'Q':
case 'K':
case 'A':
count = count - 1;
return (count +' '+ "Hold");
}
// Only change code above this line
}
// Add/remove calls to test your function.
// Note: Only the last will display
cc(10);
items
to store the items, and when you add a new item your're then iterating over that array which you never emptied
mananshah51 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
:star2: 1351 | @cmccormack |http://www.freecodecamp.org/cmccormack
mananshah51 sends brownie points to @cmccormack :sparkles: :thumbsup: :sparkles:
mgrienauer sends brownie points to @h1tag :sparkles: :thumbsup: :sparkles:
:cookie: 926 | @h1tag |http://www.freecodecamp.org/h1tag
const parse = require('csv-parse/lib/sync');
const _ = require('lodash');
const CSVtoJSON = (file) => {
return new Promise((resolve, reject) => {
let str = file
.split('\n')
.map((row, i, arr) => row.toUpperCase())
.join('\n');
let result = JSON.stringify(parse(str, {
auto_parse: true,
columns: true
}), undefined, 2);
if (!result) {
reject();
} else {
resolve(result);
}
});
}
const formatJSON = (json) => {
let resultArr = [];
let arr = JSON.parse(json);
let template = {
REF_PH: '',
REF_INICIAL: '',
DESC_SPA: '',
DESC_ENG: '',
CANT: 0,
COSTO: {
CONSIGNACION: 0,
JORDI: 0,
FRANCISCO: 0,
COMPRAS_COMUNES: 0,
TOTAL: 0,
},
PUV: 0,
PFV: 0,
NOTAS: '',
};
arr.forEach((obj) => {
let tempObj = {};
_.assign(tempObj, template);
let keys = Object.keys(obj);
let keysTemp = Object.keys(tempObj);
for (let prop in obj) {
let iteration = keys.indexOf(prop);
if (iteration <= 4) {
_.assign(tempObj, {
[keysTemp[iteration]]: obj[prop],
});
} else if (iteration >= 5 && iteration <= 9 ) {
_.assign(tempObj.COSTO, {
[keysTemp[iteration]]: obj[prop],
});
} else if (iteration >= 10) {
_.assign(tempObj, {
[keysTemp[iteration]]: obj[prop],
});
}
};
resultArr.push(tempObj);
});
cosole.log(resultArr);
return resultArr;
};
_triggerMenu(e){
let bmYposition;
let bmXposition;
let el = this.shadowRoot.querySelector('menu');
let parent = e.target.parentElement.parentElement.parentElement.parentElement;
this._validateAndDisplayDownlineLosAction(parent);
let boundingClientRect = e.target.getBoundingClientRect();
bmXposition = boundingClientRect.x - boundingClientRect.x;
bmYposition = boundingClientRect.y - 23;
if (this.shadowRoot.querySelector('.grid-wrapper').hasAttribute('screen-sm')) {
bmYposition = boundingClientRect.y - 8;
bmXposition = boundingClientRect.x + 35;
}
el.style="top:"+ bmYposition +"px; left:"+ bmXposition +"px";
this.hideBusinessMenu = false;
e.stopPropagation();
}
_triggerBusinessMenu(e){
let bmYposition;
let bmXposition;
let el = this.shadowRoot.querySelector('menu');
let parent = e.target.parentElement.parentElement.parentElement.parentElement;
this._validateAndDisplayDownlineLosAction(parent);
let boundingClientRect = e.target.getBoundingClientRect();
bmXposition = boundingClientRect.x - boundingClientRect.x;
bmYposition = boundingClientRect.y - 23;
if (this.shadowRoot.querySelector('.grid-wrapper').hasAttribute('screen-sm')) {
bmYposition = boundingClientRect.y - 8;
bmXposition = boundingClientRect.x + 35;
}
el.style="top:"+ bmYposition +"px; left:"+ bmXposition +"px";
this.hideBusinessMenu = false;
e.stopPropagation();
}
keysTemp[iteration]
this is going to work for the values > 4?
{this.state.alltimeList.map(lists =>
this
value in the callback.onClick={() => this.addAlltime()}
this.addAlltime = this.addAlltime.bind(this)
Anyone have a minute to give me a hand? Trying to get this button to hide/show the post body but it only works for the first post generated by my for loop, the other ones do nothing. Help!!!
<%- include partials/header %>
<h1>theysaid.co</h1>
<div class="container">
<% post.forEach(function(posts){ %>
<div class="card">
<div class="card-body">
<div class="post-header">
<h4><%= posts.title %></h4>
<h6><i>DATE AND TIME</i></h6>
<p id="post-body"><%= posts.body %></p>
<button type="button" id ="show" class="btn btn-outline-primary btn-pill btn-sm">show hide</button>
</div>
</div>
</div>
<% }) %>
</div>
<%- include partials/footer %>
the js:
$(document).ready(function(){
$("#show").on('click', () => {
$("#post-body").toggle()
})
})
$("#post-body").toggle()
<- doesn't specify which id="post-body" should be toggled, so the browser guesses since there are multiple
$(".btn-pill").on('click', function() {
$(this).prev().toggle();
});
rhozeta sends brownie points to @gulsvi :sparkles: :thumbsup: :sparkles:
:star2: 2629 | @gulsvi |http://www.freecodecamp.org/gulsvi
function togglePost(e) {
var post = e.target.previousElementSibling;
if(post.classList.contains('hidden')) {
post.classList.remove('hidden');
post.classList.add('visible');
} else {
post.classList.remove('visible');
post.classList.add('hidden');
}
}
<?php for ($i = 0; $i < 100; $i++): ?>
<h2>Lorem Ipsum</h2>
<p class="hidden"><?= $text?></p>
<button onclick="togglePost(event)">Toggle</button>
<hr>
<?php endfor; ?>
<script>
function togglePost(e) {
var post = e.target.previousElementSibling;
if(post.classList.contains('hidden')) {
post.classList.remove('hidden');
post.classList.add('visible');
} else {
post.classList.remove('visible');
post.classList.add('hidden');
}
}
</script>
rhozeta sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 659 | @adelmahjoub |http://www.freecodecamp.org/adelmahjoub
onclick="$(this).prev().toggle()"
replaces all of that code, if desired.
// Setup
function phoneticLookup(val) {
var result = "";
// Only change code below this line
var phoneticLookup = {
"alpha":"Adams",
"bravo": "Boston",
charlie: "Chicago",
"delta":"Denver",
"echo": "Easy",
"foxtrot": "Frank"
};
// Only change code above this line
return result;
}
// Change this value to test
phoneticLookup("charlie");
result = phoneticLookup[val];
?
.ui.form . .fields
.ui.form > .fields
but didn't hit shift
aguyinmontreal sends brownie points to @gulsvi and @adelmahjoub :sparkles: :thumbsup: :sparkles:
:cookie: 660 | @adelmahjoub |http://www.freecodecamp.org/adelmahjoub
:star2: 2630 | @gulsvi |http://www.freecodecamp.org/gulsvi
aguyinmontreal sends brownie points to @adelmahjoub :sparkles: :thumbsup: :sparkles:
:invalid
tag.
:cookie: 401 | @bradtaniguchi |http://www.freecodecamp.org/bradtaniguchi
aguyinmontreal sends brownie points to @bradtaniguchi and @gulsvi and @adelmahjoub :sparkles: :thumbsup: :sparkles:
At the "top level" of a stylesheet, an <at-keyword-token> starts an at-rule. Anything else starts a qualified rule, and is included in the rule’s prelude. This may produce an invalid selector, but that’s not the concern of the CSS parser — at worst, it means the selector will match nothing.
When interpreting a list of declarations, unknown syntax at any point causes the parser to throw away whatever declaration it’s currently building, and seek forward until it finds a semicolon (or the end of the block). It then starts fresh, trying to parse a declaration again.
in the case of that dot, it will seek forward until it find a semicolon then starts fresh and try to parse a declaration again
function confirmEnding(str, target) {
// "Never give up and good luck will find you."
// -- Falcor
var endStr = str.substr(-1, target.length);
if (endStr === target) {
return true;
} else {
return false;
}
}
confirmEnding("Bastian", "n");
confirmEnding("Open sesame", "same")
doesn't pass
confirmEnding("He has to give me a new name", "name")
str.substr(start[, length])
start
The index of the first character to include in the returned substring.
length
Optional. The number of characters to extract.