Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
One of attribute lost data when assign javascript object

I spend a day for investigating this case, but seen no hope.

const Tests = (state = INIT_STATE, action) => {
  switch (action.type) {
    case GET_TEST_DETAIL:
      return {
          ...state,
          test: {},
          error: {},
          updatingTest: true,
      }

    case GET_TEST_DETAIL_SUCCESS:
      const test = action.payload
      console.log(action.payload.shortName)//has data
      test["shortName2"] = action.payload.shortName//has data
      test["shortName"] = action.payload.shortName//empty string

      console.log(test)

      return {
          ...state,
          test: test,
          updatingTest: false,
      }

There is the picture captured when I console.log in firefox, and Edge: enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

There's nothing wrong.

const action  = {
  payload: {
    shortName: 'I am a shortname'
  }
}

      const test = action.payload
      console.log(action.payload.shortName)//has data
      test["shortName2"] = action.payload.shortName//has data
      test["shortName"] = action.payload.shortName//empty string

      console.log(test)

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!