get help in general - we have more specialized help rooms here: https://gitter.im/FreeCodeCamp/home
text-transform
initial
and none
?
none
is to remove text transform and initial
is to set it to default value ? ( not sure )
Hello guys, I got stuck on this.
let ohStr = "Ohhh no";
let ohRegex = /h{3,6}/; // Change this line
let result = ohRegex.test(ohStr);
function AlphabetSoup(str) {
var res = str.split("");
res.sort();
var sorted = "";
for (i=0; i < res.length; i++){
sorted = sorted.concat(res[i]);
}
return sorted;
}
AlphabetSoup(readline());
h
?
```<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>
.red-text {
color: red;
}
#cat-photo-element{
background-color:green;
}
h2 {
font-family: Lobster, monospace;
}
p {
font-size: 16px;
font-family: monospace;
}
.thick-green-border {
border-color: green;
border-width: 10px;
border-style: solid;
border-radius: 50%;
}
.smaller-image {
width: 100px;
}
.silver-background {
background-color: silver;
}
</style>
<h2 class="red-text">CatPhotoApp</h2>
<main>
<p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>
<div class="silver-background">
<p>Things cats love:</p>
<ul>
<li>cat nip</li>
<li>laser pointers</li>
<li>lasagna</li>
</ul>
<p>Top 3 things cats hate:</p>
<ol>
<li>flea treatment</li>
<li>thunder</li>
<li>other cats</li>
</ol>
</div>
<form action="/submit-cat-photo" id="cat-photo-form">
<label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
<label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
<label><input type="checkbox" name="personality" checked> Loving</label>
<label><input type="checkbox" name="personality"> Lazy</label>
<label><input type="checkbox" name="personality"> Energetic</label><br>
<input type="text" placeholder="cat photo URL" required>
<button type="submit">Submit</button>
</form>
</main>
@taloloy18
Your form element should have the background-color of green.
where have you assigned the class that holds the green border property?
if you mean this:
#cat-photo-element{
background-color:green;
}
well, that's a wrong ID :)
<form action="/submit-cat-photo" id="cat-photo-form">
Hey all!
I've come to a roadblock again regarding conditional (ternary) operators.
I'm trying to check if 2 numbers are equal or not
function checkEqual(a, b) {
return (a === b ? "a is equal to b" : "b is equal to a");
}
checkEqual(1, 1);
<style type='text/sass'>
$radius:15px;
@mixen border-radius($radius){
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
}
#awesome {
width: 150px;
height: 150px;
background-color: green;
}
div{
@include border-radius(15px);
}
</style>
<div id="awesome"></div>
can someone tell me why my mixen isn't being declared in the challenge?
mixin
?
//Ternary syntax
// condition ? valueForTruthy : valForFalse
1 > 2 ? true : false; //returns false
a === b ? true : false ; // returns true when a == 1 and b == 1
document.getElementById()
or querySelector()
?
playSound(e) {
const sound = document.getElementById(this.props.keyTrigger);
ref
and not with getElementById
[].slice.call(document.getElementsByClassName('clip'))
rly :D
omg ...
User Story #4: Within each .drum-pad, there should be an HTML5 audio element which has ...
this is not awesome
function somefunc( callback ) {
var somestring = "test"
callback(somestring)
}
var returnedValue = someFunc()
var myPerson = Person.findById(personID)
Person.findById(personID).then(myPerson => { console.log(myPerson) });
.catch
on the return from an async function
Person.findById(personId, (returnedPerson)=>{console.log("Person2: " + returnedPerson)})
catch()
was failing
catch()
was failing
let userId;
try {
const { _id } = jwt.verify(cookies.bookclub, JWT_SECRET);
userId = _id;
} catch (e) {
userId = false;
}
findById()
coming from? mongoose? mongodb?
Model.findById()
Parameters
id «Object|String|Number» value of _id to query by
[projection] «Object|String» optional fields to return, see Query.prototype.select()
[options] «Object» optional see Query.prototype.setOptions()
[callback] «Function»
Returns:
«Query»
Adventure.findById(id, 'name length', function (err, adventure) {});
, function (err, doc) { ... }
callback(null, doc)
toUpperCase()
instead of stupid regex? weird
document.addEventListener('keypress', event => {
if (event.key.toUpperCase() === this.props.trigger) {
this.playSound();
};
});
so much easier than document.addEventListener('keypress', event => {
const regex = RegExp('[' + this.props.trigger + ']', 'i');
if (regex.test(event.key)) {
this.playSound();
};
});
Math.trunc()
removes all numbers after a .
, Math.ceil()
returns the smallest integer greater than or equal to a given number
Math.trunc(1.1)
will be 1
but Math.ceil(1.1)
will be 2. using the + 1
is all good until you get a number without a decimal, then Math.trunc(1) + 1
will be 2 but Math.ceil(1)
will be 1
export let exercisesArr;
export default class Exercise {
costructor(query){
this.query = query;
}
async getExercises(){
try{
const res = await axios('https://raw.githubusercontent.com/dbsimeonov/fitme-today/master/src/data/exercises.json');
this.result = res.data.exercises;
exercisesArr = res.data.exercises;
console.log(exercisesArr);
}catch(err){
console.log(err);
}
}
}
I'm trying to create a function that I can reuse and call objects, and also to store the entire object on separate variable which I though will be easy but failed..
axios.get()
for get requests, axios.post()
for post requests, etc
axios
, first time I use it tru npm
and saw this way on uDemy Course :smile: :smile:
promises
, I will try again simplified. After that might build a function to build the markup with constructor
?
constructor
only gets called once, when the class gets instantiated - so you only want to put things in there that are relevant to the creation of the class instance
this.title, this.img etc
because the way I'm thinking will be way too long and wrong
html elements
for each of the data objects
html templates
just don't know how to form a function to take my data after the axios call
object
to be an array
?
const bodyPartNames = Object.keys(data.exercises);
bodyPartNames.map(bodyPartName => {
const bodyPart = data.exercises[bodyPartName];
const exerciseNames = Object.keys(bodyPart);
const exercises = exerciseNames.map(name => bodyPart[name]);
....
});
exercise
I can use something like html template string
and pass the data I want?
webpack
is, and now trying to keep up with the new things but noticed its been a big step
boxes
.html
.