Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 21 2018 17:11
    @MadLittleMods banned @OmarAlmaqtri
  • Jun 05 2018 23:13
    @MadLittleMods banned @LWSS
  • May 25 2018 16:50
    @MadLittleMods banned @TheRedstoneTaco
Nadia
@nadiaschutz
@taburetkin could you please explain what does each step do?
dimtabu
@taburetkin
sure
Nadia
@nadiaschutz
можешь на русском если удобнее
в крайнем случае на китайском
dimtabu
@taburetkin
))))
khinekhinemyatnoe
@babemyatnoe_gitlab
Hello there!:)
can someone help me?
i do need help with js codes.
i'm new and can i get a chance to get a reply?
khinekhinemyatnoe
@babemyatnoe_gitlab
i've downloaded this https://codepen.io/elmahdim/pen/tEeDn and i wanted to add their js function to my own design
nicfaust
@nicfaust
🙄 беда печаль
Abdul Basit
@Abdul___Says_twitter
@babemyatnoe_gitlab please ask, which problem are you facing ?
Richard Sithole
@Sliqric7053

Hi there

I have a 10x4 grid of checkboxes (call it x, y) - I would like to get the coordinates (x, y values) of the checkbox when a user selects one. What data structure can I use to pluck out those coordinates?

I've tried using a Map like so:

 onCheck(e) {
    const productMap = new Map();

    productMap.set('productId', e.path[2].id.split('-').pop());
    productMap.set('productLevelId', e.path[2].id.split('-').pop());
}

The checkboxes are generated dynamically, so I use a click event listener and pass in the checkbox element..

The backend expects from me, a response like this:

{
productId: 4,
productLevelId: 1
}

Any ideas how I can accomplish this?

dimtabu
@taburetkin
when you click on a checkbox then change event is emited
event.target in that case will point to your checkbox dom element
you can add additional attributes to the dom element
<input type="checkbox" data-id="yourProductId" data-levelid="yourLevelId">
and then extract this values in the change event from the event target
Richard Sithole
@Sliqric7053
@taburetkin thanks - much appreciated, lemme give it a go.
Shekhar Ramola
@shekharramola
if I do like this, would you expect array to get modified?
```
   this.myForm.value.arr.forEach(form => {
      this.filesToSend.forEach(element => {
        element = element + '=' + form.password;
        console.log(element);
      });
    });
    console.log(this.myForm);
    console.log(this.filesToSend);
  }
```
inside it is getting modified but no effect on filestosend array
Stephen James
@sjames1958gm
If element is a reference to the value in the array, you are changing the vale of the reference not the value being referred to. So no it would not change the array
Remove that first ‘if’ in the above sentence
Shekhar Ramola
@shekharramola
if statement is not there. where it is?
yousefMZ
@yousefMZ
what is the code in codewars ?? javascriptfunction multiply(a, b){
a * b
}
Stephen James
@sjames1958gm
@shekharramola oh lol, I meant the ‘if’ in my response not in your post.
Jefferson
@jeffersonnnn
hey guys
EuphoricPenguin
@EuphoricPenguin
this is Austin
syedsimanta03
@syedsimanta03
import store from './store/store';

console.log('Before:', store.getState());
sometimes in Node or React we use store.getState() and sometimes store.getState. Without direct invoking, why is that? what is the difference? Thanks
Anjul
@anjultramp_twitter

Hi All I have run into a problem I am uanble to call values of Array from different JS file. See the attached code for your refernence

File1//
import {DataVal} from './DateValue';

DataVal.map((item) =>{
console.log ("Date: "+ item.date);
});

File2//

export const DataVal =
[
{
date:"07/08/2010" .........................................
......................................

dimtabu
@taburetkin
and the error is ... ?
Anjul
@anjultramp_twitter

/home/aanjul/Desktop/Practice/Dateshorting.js:1
import user from './DateValue';
^^^^

SyntaxError: Unexpected identifier

dimtabu
@taburetkin
what is your environment?
or how do you run your app
Anjul
@anjultramp_twitter
I am running the code through linux Terminal
dimtabu
@taburetkin
so, i suppose in nodejs
show me the command
Anjul
@anjultramp_twitter
node Dateshorting.js
dimtabu
@taburetkin

ok
your question is related to node
by default nodejs does not support es6 import export directives
most easies way to run es6 scripts in node i know is run scripts with esm package installed

npm install --save-dev esm

and your run command should be like this

node -r esm Dateshorting.js
or, you can rewrite all your scripts from es6 to commonjs format
and use require('....') / module.exports = ... instead of import/export
or
you can rename all your scripts from .js to .jsm and enable experimental es6 features in node
read about this in nodejs documentation
also, be sure you have latest version of nodejs, latest nodejs support more es6 features (but still not all)
Anjul
@anjultramp_twitter
my current version is v12.9.1
Shekhar Ramola
@shekharramola
Is this a correct syntax?
image.png
function(){ console.log(i)) }
because isn't java script engine expect a name when it heard function keyword?
Shekhar Ramola
@shekharramola
or it became anonymous because of surrounding with parenthesis of arr.push
dimtabu
@taburetkin
functions in js can be anonymous, @shekharramola
check the mdn docs in section functions
ptmhpp
@ptmhpp

Hi All,
I have a javascript class with few getter whose name are almost same with some difference

I want to call a getter with its name formed during the runtime as it will reduce lot of lines of codes in our automation scripts



class automationClass extends Page {
/**

  • define elements
    /
    get abcObject() {
    return browser.isAndroid ? $("//
    [@text='Show values for: ']") : $("//[@text='Show values for: ']")
    }
    get defObject() {
    return browser.isAndroid ? $("//
    [@text='Departure']"): $("//[@text='Departure']")
    }
    get xyzObject() {
    return browser.isAndroid ? $("//
    [@text='Stayover']") : $("//[@text='Stayover']")
    }
    /*
  • function to click an object, objParameter parameter coming from another file according to user input
    */
    clickObject(objParameter) {
    Var lObj=objParameter+”Object”
    this.lObj.click() ////this is not working,,,,,any alternative????
    }


    }

i have used eval function and was working fine to call a function
but eval is not working for class and getter