Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Aug 17 09:32
    User @bjorno43 unbanned @linkin-park
  • Jun 20 21:19
    @bjorno43 banned @shenerd140
  • Apr 25 17:13
    @mstellaluna banned @cmal
  • Jan 08 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
  • Jul 29 2018 01:00
    @bjorno43 banned @jkyereh
  • Jul 10 2018 22:09
    @bjorno43 banned @manafn
  • Jul 06 2018 15:20
    @texas2010 banned @imlegend19
  • Jul 03 2018 12:28
    @bjorno43 banned @vbvmatta
  • Jun 29 2018 13:54
    @bjorno43 banned @OGTechnoBoy
Aymen
@AymenAlSalem
here is a lesson from FCC youtube that helped me to fully understand CSS grid : https://www.youtube.com/watch?v=t6CBKf8K_Ac&t=28s
include*engine
@newtothat
what do you think about IT courses by google
Brad
@bradtaniguchi
@newtothat Do you want to learn IT stuff?
include*engine
@newtothat
@bradtaniguchi yes it helps to understand and going through history of technolgy and comparing tools that we had by than and what we have now
learning how computer works actually it helps me to understand .I mean everything you learn about computers.each skill helps to understand the other new ones easier and everything kinda starts to make sense
include*engine
@newtothat
or Learning IT stuff is like preperation for computer science. And computer science in english is more like for native englis speakers
midnitedev101
@midnitedev101
@bjorno43 , @Abott1222, @richRocksCodeBlocks Thanks guys!
mpmaan
@mpmaan
This program prints undefined. I don't know what's wrong. Can anybody help?
function checkCashRegister(price, cash, cid) {
  let hash = {
    "PENNY": 0.01,
    "NICKEL": 0.05,
    "DIME": 0.1,
    "QUARTER": 0.25,
    "ONE": 1,
    "FIVE": 5,
    "TEN": 10,
    "TWENTY": 20,
    "ONE HUNDRED": 100
  }
console.log(available(hash, cid));
}
function available(hash,cid){
  return cid.reduce((prev, curr)=>{
    prev += hash[curr[0]]*curr[1];
  },0);
}
checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]);
abraham anak agung
@padunk
@mpmaan you need to return inside your reduce function
mpmaan
@mpmaan
@padunk thanks
abraham anak agung
@padunk
@mpmaan np, if you want to calculate total in cid, you don't need hash
mpmaan
@mpmaan
i need to map "HUNDRED" to 100 then multiply it with available number of notes
second value in 1D arrays is the number of notes/coins
abraham anak agung
@padunk
@mpmaan i think the cid is like ONE HUNDRED, 100 means you have 1 ONE HUNDRED. TWENTY, 60 means you have 3 TWENTY notes
mpmaan
@mpmaan
lol..really..i need to check the problem statement
abraham anak agung
@padunk
yup :smile: so in total you have just about 300 something, not 11 thousand, that is too much
mpmaan
@mpmaan
i am unable to conclude that from the question
ok..got it
because for "PENNY" number of coins can't be fraction like 1.01
abraham anak agung
@padunk
@mpmaan PENNY is 0.01 notes so 1.01 will be 101 pennies
mpmaan
@mpmaan
yeah..now i need to modify a lot of code
Simon Cordova
@gbsimon87
Hey all! - was wondering if anyone could lend a quick hand
I've got an input, imagine a pinpad, and upon clicking a button, I only want to show the last digit on the input, but the previous digits must be an asterisk - any thoughts how to accomplish such a task?
mpmaan
@mpmaan
@gbsimon87 i don't understand what do you want to do? what do you mean by previous digits being asterick?
if i press 3 should the output be *3?
or like those login forms where the password is invisible except for the last digit?
Simon Cordova
@gbsimon87
like login forms where the pass is invisible except the last digit
@mpmaan
mpmaan
@mpmaan
you can try something like n = length_of_the_character_in_input_field and then replace it with newInput = ***(upto n times) + new_entered_digit
Simon Cordova
@gbsimon87
@mpmaan I'm trying something similar to no avail, I'll copy what you wrote so I can follow it closely thank you
mpmaan
@mpmaan
@gbsimon87 the method i told you might cause inconvenience to users. if they pressed * then it will seem like it has been hidden , for example if current input is ***3 and user presses * then new input will be *****
what is 'no avail`?
Simon Cordova
@gbsimon87
@mpmaan
No avail means no success
The only way the user can input a number is by clicking a button with the mouse, not with the keyboard.
The layout itself is an pinpad, so a disabled input up top and 9 numbers at the bottom. Upon clicking a button, it will take that button's value and insert it in the input. Currently it's working well just showing every number, I need to mask al but the last digit
mpmaan
@mpmaan
like when user has entered correct pin it will automatically login into account or something similar
without the need to press enter or any submit button?
Simon Cordova
@gbsimon87
Exactly
I've got everything in functionality except the hiding of all but the current last digit
mpmaan
@mpmaan
then my method should work
but there mightbe some delay when updating the input
although user won't notice it because of presence of * characters
most probably lol
Simon Cordova
@gbsimon87
I'll try it out :)
Claudio Restifo
@Marmiz
@gbsimon87 something like
const hide = n =>
('' + n).slice(0, -1).replace(/./g, '*') + ('' + n).slice(-1);
you can add more argument to change the hiding char or the length of the visible number
caution: the return val is a string and not a number (since it has * in it)
Simon Cordova
@gbsimon87
@Marmiz thank you, it can be either a string or number really, current they're strings in my app anyway
mpmaan
@mpmaan
what wil slice(0,-1) do?
Claudio Restifo
@Marmiz
return everything but the last letter of the string

from mdn

If negative, it is treated as strLength + endIndex where strLength is the length of the string (for example, if endIndex is -3 it is treated as strLength - 3).