https://
?
assets
folder...
src='assets/etc'
the assets folder needs to be in the same directory as about.html
src='/assets/etc'
should do it
</head>
<body class="container-fluid">
<header class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Random Quote Generator</h1>
<h2>Inspirational Quotes</h2>
</div>
</header>
</head>
<body class="container-fluid">
<header class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Random Quote Generator</h1>
<h2>Inspirational Quotes</h2>
</div>
</header>
I am not entirely sure what following two programs do:
function showPrimes(n) {
nextPrime: for (let i = 2; i < n; i++) {
for (let j = 2; j < i; j++) {
if (i % j == 0) continue nextPrime;
}
console.log( i );
}
and
function showPrimes(n) {
for (let i = 2; i < n; i++) {
if (!isPrime(i)) continue;
alert(i);
}
}
function isPrime(n) {
for (let i = 2; i < n; i++) {
if ( n % i == 0) return false
}
return true;
}
These are two examples available on JS.info website. None of them log
or alert
anything. :(
alert
and console.log
to test them.
showPrimes(10)
for example it will console log out 2, 3, 5, 7
}
but I am guessing it is there in the real code
showPrimes(10)
2
3
5
7
continue
in program? How it works? What's its coding name? Is it kind of an attribute?
continue <label>
in real code.
Is my program error free now?
function showPrimes(n) {
nextPrime: for (let i = 2; i < n; i++) {
for (let j = 2; j < i; j++) {
if (i % j == 0) continue nextPrime;
}
console.log( i ); // a prime should be logged in console.
}
}
showPrimes(10);
It still logs nothing.
n
to 10
; no response.
showPrimes(10)
continue
in real code then JS.info is probably overusing labels.
prompt
function accept integers?
function pairElement(str) {
var arr = [[],[]];
var i = 0;
// return len = str.length;
while(i < str.length)
{
if(str[i] == 'G')
{
arr[i][0] ="G";
arr[i][1] = "C";
}
//if(str[i] == 'C')
// {
// arr[i][0] ="G";
// arr[i][1] = "C";
// }
/* if(str[i] == 'C')
{
arr[i][0] ="C";
arr[i][1] = "G";
}
if(str[i] == 'T')
{
arr[i][0] = "T";
arr[i][1] = "A";
}
if(str[i] == 'A')
{
arr[i][0] = "A";
arr[i][1] = "T";
}
*/
i++;
}
return arr;
}
pairElement("GCG");
arr
a different way rather thanlet addition = prompt("Your Number");
let sum = (addition + 7);
console.log(sum);
This is what I am trying to do.
scroll
event .
function pairElement(str) {
var arr = [[],[]];
var i = 0;
// return len = str.length;
while(i < str.length)
{
if(str[i] == 'G')
{
arr[0][0] ="G";
arr[0][1] = "C";
}
//if(str[i] == 'C')
// {
// arr[i][0] ="G";
// arr[i][1] = "C";
// }
/* if(str[i] == 'C')
{
arr[i][0] ="C";
arr[i][1] = "G";
}
if(str[i] == 'T')
{
arr[i][0] = "T";
arr[i][1] = "A";
}
if(str[i] == 'A')
{
arr[i][0] = "A";
arr[i][1] = "T";
}
*/
i++;
}
return arr;
}
pairElement("GCG");
var arr = [[], []]
this assumes only two values in the string.
arr
function add7() {
let addition = parseInt(prompt('your integer please')) + 7;
console.log(addition);
}
add7();
1532j0004kg sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8931 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
+
to convert a string to numbervar one = "1"
+one + 2
ajbozdar sends brownie points to @sjames1958gm :sparkles: :thumbsup: :sparkles:
:star2: 8932 | @sjames1958gm |http://www.freecodecamp.org/sjames1958gm
function add7() {
let addition = parseInt(prompt('your integer please')) + 7;
return addition;
}
function add7() {
return parseInt(prompt('your integer please')) + 7;
}
function pairElement(str) {
var arr = [[],[]];
var i = 0;
while(i < str.length)
{
if(str[i] == 'G')
{
arr[0][0] ="G";
arr[0][1] = "C";
}
if(str[1] == 'C')
{
arr[1][0] ="G";
arr[1][1] = "C";
}
i++;
}
return arr;
}
pairElement("GCG");
For example, for the input GCG, return [["G", "C"], ["C","G"],["G", "C"]]
[["G", "C"], ["G", "C"]]
return
the addition but to see the addition either I need to alert
or console.log
. Am I right?
console.log(add7());
var arr = [[],[]];
this code here assumes two values in the string.ajbozdar sends brownie points to @515014k :sparkles: :thumbsup: :sparkles:
:cookie: 171 | @515014k |http://www.freecodecamp.org/515014k
Traversy Media
this is another
ajbozdar sends brownie points to @muhammedkarim :sparkles: :thumbsup: :sparkles:
:cookie: 115 | @muhammedkarim |http://www.freecodecamp.org/muhammedkarim
muhammedkarim sends brownie points to @ajbozdar :sparkles: :thumbsup: :sparkles:
:cookie: 262 | @ajbozdar |http://www.freecodecamp.org/ajbozdar
Please tell me if I am coding right?
function capitalize() {
let text = prompt("Some text here!");
return text[0].toUpperCase() + text.slice(1);
}
console.log(capitalize());
Thanks!
destroyer([1, 2, 3, 1, 2, 3], 3, 2);
- the array is the first argument [1, 2, 3, 1, 2, 3]
, and the 3 and 2 are the additional arguments. They have provided a link for the arguments
object - you use that to access all of the function arguments, and in this case, you want to use it to get the arguments that follow the initial array. The problem statement says: Remove all elements from the initial array that are of the same value as these arguments.
So you find any arguments in the initial array that are contained in the list of the arguments that follow the initial array and remove them, return an array that has any remaining arguments. For the example that I put above, you would remove any 2
and 3
from the initial array, and return [1, 1]
You have to be able to handle any number of additional arguments, so this one has two, some have three, but you can write code that will handle any number of arguments, so don't just hard code 2 and 3 as the count of values.
.filter()
method. You can also use for
loops and just do all of the code that way, or use some of the higher-order functions like filter()
to do the job.
import React from 'react';
import Modal from 'react-bootstrap-modal';
import ReactDOM from 'react-dom';
export class AddRecipe extends React.Component {
constructor(){
super();
this.state = {
show: false
}
this.closeModal = this.closeModal.bind(this);
this.showModal = this.showModal.bind(this);
}
showModal(){
this.setState({
show: true
});
}
closeModal(){
this.setState({
show: false
});
}
render(){
return (
<div>
<button onClick={this.showModal}>Add Recipe</button>
<Modal show={this.state.show} onHide={this.closeModal}>
<Modal.Header>
<Modal.Title>Add Recipe:</Modal.Title>
</Modal.Header>
<Modal.Body>
<h2>Name:</h2>
<input />
<hr />
<h3>Instructions</h3>
<textarea></textarea>
</Modal.Body>
<Modal.Footer>GG</Modal.Footer>
</Modal>
</div>
);
}
}
ReactDOM.render(<AddRecipe />, document.getElementById('app'));
TypeError: Cannot read property 'createClass' of undefined
create-react-app
?
@MuhammedKarim
< YourElement style = text-align: center; > </YourElement>
The grammar is same for whatever you want to align to the center of your page.
text[0]
will be undefined if text
is empty @ajbozdar
if(text == "") return "";
text-align: center;
iframe {margin:auto; display:block}
enigmacipher sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 229 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
teo03 sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 231 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
<a href="https://www.google.ca" target="_blank">
<button style="padding: 24px 24px 24px 24px;" class="btn round" type=""> </button>
<button> <input type="image" height="100px" width="100px" src="https://cdn.pixabay.com/photo/2016/04/28/23/55/snapchat-1360003_960_720.jpg" class=" round" name=""> <
<button style="padding: 24px 24px 24px 24px; background: url('https://cdn.pixabay.com/photo/2016/04/28/23/55/snapchat-1360003_960_720.jpg');" class="round centre btn img-responsive" type="">
</button >
<button style="padding: 24px 24px 24px 24px;" class="btn round " type="">
</button>
<button style="padding: 24px 24px 24px 24px;" class="btn round " type="">
</button>
</a>
</div>
'''
:bulb: to format code use backticks! ``` more info
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Page 1
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Page 1-1</a></li>
<li><a href="#">Page 1-2</a></li>
<li><a href="#">Page 1-3</a></li>
</ul>
</li>
zootechdrum sends brownie points to @muhammedkarim :sparkles: :thumbsup: :sparkles:
:cookie: 116 | @muhammedkarim |http://www.freecodecamp.org/muhammedkarim
muhammedkarim sends brownie points to @marahman49 :sparkles: :thumbsup: :sparkles:
:cookie: 28 | @marahman49 |http://www.freecodecamp.org/marahman49
style="height:100%"
Hi, I want to ask a question about a challenge in Exact Change
if I have
checkCashRegister(19.50, 20.00,
[
["PENNY", 1.01],
["NICKEL", 2.05],
["DIME", 3.10],
["QUARTER", 4.25],
["ONE", 90.00],
["FIVE", 55.00],
["TEN", 20.00],
["TWENTY", 60.00],
["ONE HUNDRED", 100.00]
]);
about the ["FIVE", 55.00]
does it means I have 55/5 = 11 Five dollars cash?
style="height: 100vh"
muhammedkarim sends brownie points to @zd-zero :sparkles: :thumbsup: :sparkles:
:cookie: 290 | @zd-zero |http://www.freecodecamp.org/zd-zero
muhammedkarim sends brownie points to @leeconnelly12 :sparkles: :thumbsup: :sparkles:
:cookie: 189 | @leeconnelly12 |http://www.freecodecamp.org/leeconnelly12
margin:0
?
background: url('../img/foremost-hero.jpg');
background-repeat: no-repeat;
background-position: center center;
-webkit-background-size: cover;
background-size: cover;
position: relative;
top: 0;
bottom: 0;
height: 100vh;
z-index: 1;
}