A
A
Alexander Show2019-11-24 14:51:50
Web development
Alexander Show, 2019-11-24 14:51:50

How to correctly write data to an array and what is the logic?

Create two fields. In one, the user enters a birthday, in the second - a month (in the form of a number). Print the zodiac sign under which the user was born. Store data about the sign of the zodiac in an array.
This is the task of how to correctly write data to an array ?????

Answer the question

In order to leave comments, you need to log in

5 answer(s)
P
prrrrrrr, 2018-11-29
@prrrrrrr

I would like to make the registration form so that it is 1,2,3,4,5,6
- this is for freelancers

D
Dmitry Makarov, 2018-11-29
@MDiMaI666

Budget version use Google Forms
Or google services

S
Sergey Mukhin, 2019-11-24
@AlexShow163

I would do that

const signs = [
  { name: 'Овен', from: 321, to: 419 },
  { name: 'Телец', from: 420, to: 520 },
  { name: 'Близнецы', from: 521, to: 620 }
]

321 is month 3 on the 21st
419 is month 4 on the 19th
, etc.
For example, take month 4 (April) and day 25 .
We connect in 425
We go on an array and we look for in whose interval 425 will get. In our cases, from 420 to 520. So Taurus .

A
Anton Neverov, 2019-11-24
@TTATPuOT

let array = [];

array.push('Первое значение', 'Второй значение');

What exactly is the problem?
It is better to use objects for this task rather than arrays.

P
profesor08, 2019-11-24
@profesor08

https://developer.mozilla.org/en/docs/Web/JavaScript...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question