by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 19 20:09
    @krisb1220 banned @Gastony
  • May 14 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 22:38
    @bjorno43 banned @real-action
  • Feb 01 00:27
    @bjorno43 banned @Ndoua
  • Jan 07 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 2019 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 2019 17:13
    @mstellaluna banned @cmal
  • Jan 08 2019 22:05
    @mstellaluna banned @dertiuss323
  • Nov 07 2018 04:42
    User @texas2010 unbanned @ows-ali
  • Nov 02 2018 16:25
    @texas2010 banned @ows-ali
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:12
    User @bjorno43 unbanned @androuino
  • Sep 05 2018 07:38
    @bjorno43 banned @androuino
  • Aug 23 2018 16:57
    User @bjorno43 unbanned @rahuldkjain
  • Aug 23 2018 16:23
    @bjorno43 banned @rahuldkjain
  • Jul 29 2018 14:13
    User @bjorno43 unbanned @jkyereh
wnghero
@wnghero
@iangracia heres how I did that problem
CamperBot
@camperbot
wnghero sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 350 | @iangracia |http://www.freecodecamp.com/iangracia
wnghero
@wnghero
// Setup
var collection = {
    2548: {
      album: "Slippery When Wet",
      artist: "Bon Jovi",
      tracks: [ 
        "Let It Rock", 
        "You Give Love a Bad Name" 
      ]
    },
    2468: {
      album: "1999",
      artist: "Prince",
      tracks: [ 
        "1999", 
        "Little Red Corvette" 
      ]
    },
    1245: {
      artist: "Robert Palmer",
      tracks: [ ]
    },
    5439: {
      album: "ABBA Gold"
    }
};
// Keep a copy of the collection for tests
var collectionCopy = JSON.parse(JSON.stringify(collection));

// Only change code below this line
function updateRecords(id, prop, value) {
  if(value !== "" && prop !== "tracks"){
    collection[id][prop] = value;
  }  else if(prop=="tracks"&&value!==""&&collection[id][prop]===undefined){
    collection[id][prop] = [];
    collection[id][prop].push(value);
  } else if(prop=="tracks"&&value!==""){
    collection[id][prop].push(value);
  } else if(value===""){
    delete collection[id][prop];
  }

  return collection;
}

// Alter values below to test your code
updateRecords(5439, "tracks", "Take a Chance on Me");
Ian Gracia
@iangracia
i found the problem
i was missing [id]
wnghero
@wnghero
ahhh
Ian Gracia
@iangracia
wrong : collection.hasOwnProperty(prop);
right: collection[id].hasOwnProperty(prop);
dont you just love coding? :coding:
:cry:
wnghero
@wnghero
lmao it sucks but the money thoooo
Ian Gracia
@iangracia
right? @wnghero
Sorin Ruse
@sorinr
@Pickorita do u have it some place where we can see it live?
Nickey Pickorita
@Pickorita
@sorinr yea, I will send you a dm
Justine Diza
@JustineDiza

@JustineDiza
Hi! Does anyone here use UI Router? I have a problem with my code, been trying to find other solutions for about an hour now, help is pretty much appreciated!
Here's my HTML base:

<ul class="formSteps uk-margin-large-top">
            <li ui-sref-active="active">
                <a ui-sref=".substep" class="removeLink">Basic Information</a>
            </li>
            <li ui-sref-active="active">
                <a ui-sref=".step_four" class="removeLink">Business Information</a>
            </li>
            <li ui-sref-active="active">
                <a ui-sref=".step_five" class="removeLink">Business Activity</a>
            </li>
            <li>
                <a class="removeLink">Documents</a>
            </li>
            <li>
                <a class="removeLink">Gallery</a>
            </li>
            <li>
                <a class="removeLink">Employee</a>
            </li>
            <li>
                Complete
            </li>
        </ul>

        <!-- Substeps for step1 go here -->
        <div ui-view="substep"></div>

<div class="br-form-container">
            <div class="page-header text-center">
                <!-- Our nested state views will be injected here -->
                <div ui-view></div>
            </div>
        </div>

Here's my route.js:

// Adding state for substeps
            .state('business_registration.substep', {
                url: '/1-sub',
                data: { activeTab: 'business'},
                controller: 'AccountBusinessController',
                params: {
                    businessType: null
                },
                controllerAs: 'abc',
                views: {
                    '': {
                        templateUrl: 'business/step1.html'
                    },
                    'substep@business_registration.substep': {
                        templateUrl: 'business/substep.html'
                    }
                }
            })

What I'm trying to do is to have 2 separate step progress counter, where the substep consists of substeps for different views, but it doesn't show up in the page.

Ian Gracia
@iangracia
var x = 0;

x += 1.01;
x += 2.05;

console.log(x);

//why does this equal 3.0599999999999996
//and not 3,06???
CamperBot
@camperbot
piteto sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
:cookie: 352 | @iangracia |http://www.freecodecamp.com/iangracia
Ian Gracia
@iangracia
@piteto thx, will study
CamperBot
@camperbot
iangracia sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 185 | @piteto |http://www.freecodecamp.com/piteto
piteto
@piteto
var x = 0;

x += 1.01;
x += 2.05;

console.log(Number(x.toFixed(2)));
// or
console.log(Number(parseFloat(x).toPrecision(12)));
Ian Gracia
@iangracia
can't belive simple math has to be so complicated
Dennis Daubney Jr
@MrOolong
Hi all, i'm trying to get my freecodecamp quote gen to post the quotes to twitter, but i'm currently stuck with the javascript. Could anyone take a look at my code and lend a hand?
Ian Gracia
@iangracia
@piteto why do you have to use parsefloat if the variables aren't strings?
i'm having a hard time wrapping my head around this simple problem
piteto
@piteto
@iangracia You don't have to in that example - it works with numbers or strings
CamperBot
@camperbot
piteto sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
api offline
piteto
@piteto
You could do something like this to facilitate:
var x = 0;

x += 1.01;
x += 2.05;
x = preciseValue(x);

console.log(x);

function preciseValue(num) {
  return Number(parseFloat(num).toPrecision(12));
}
@MrOolong To use the official twitter share button, you'll need to use their code for generating the button and specifying the text: https://dev.twitter.com/web/tweet-button/javascript-create
If you don't care how the button looks, make it a hyperlink, style it like a button, and link to:
https://twitter.com/intent/tweet?text="your quote text"
Ian Gracia
@iangracia
you are just confusing me when you're using a function without the need of it
lmao
but shouldnt toPrecision(3) be the correct use?, should 12 give me like 11 decimals
Dennis Daubney Jr
@MrOolong
@piteto and if I don't want to manually specify the text to tweet? What if I want to tweet the quote in the DOM element that's generated from an array in the JS file?
piteto
@piteto
@MrOolong You would replace "your quote text" in that example above with a variable representing the text you want to tweet
In your case, the "textToTweet" variable
basically, to make your current window.open code work, you'll need to remove your html that pulls in the twitter widget code: //platform.twitter.com/widgets.js
Dennis Daubney Jr
@MrOolong
i think I just figured out another way
Ian Gracia
@iangracia
var x = 3.0599999999999996;

console.log(Number(x.toPrecision(1)));  //  3
console.log(Number(x.toPrecision(2)));  // 3.1
console.log(Number(x.toPrecision(3)));  // 3.06
console.log(Number(x.toPrecision(4)));  // 3.06 ????
console.log(Number(x.toPrecision(7)));  // 3.06????
console.log(Number(x.toPrecision(9)));  // 3.06???
why does it stop at 2 decimals
piteto
@piteto
@iangracia because there are only 2 significant digits after the decimal point. Try it with a different number, like: var x = 3.12345999999996;
CamperBot
@camperbot
piteto sends brownie points to @iangracia :sparkles: :thumbsup: :sparkles:
api offline
Dennis Daubney Jr
@MrOolong
@piteto thank you for steering me in the right direction with the link to the twitter button. I got it to work with this twttr.widgets.createShareButton(
'/',
document.getElementById('quotebox'),
{
text: document.getElementById('quotebox').innerHTML
}
);
CamperBot
@camperbot
mroolong sends brownie points to @piteto :sparkles: :thumbsup: :sparkles:
:cookie: 186 | @piteto |http://www.freecodecamp.com/piteto