0

I can access a code from the server that states the student name and it is "l18", variable apparently. Like when you're sending the grades their name variable is l18.

I need to define a link for the students (which is not provided by default in the server but we have a JavaScript playground to deal with the server). The number is rather big and we have more than 800 students.

Let's make a fictional list and use it:

const StudentCode = {
  [Jack]: [32658495],
  [Rose]: [35621548],
  [Lita]: [63259547],
  [Seth]: [27956431],
  [Cathy]:[75821456],
};

Their code goes to the end of this url: https://www.school.com/members?= and the question is how will you be able to generate for example https://www.school.com/members?=75821456 for Cathy, as we defined it in const StudentCode?

May be these information would be necessary as it is a repetition: We have stated new variables in const block so l18, whatever it contains as student's name, matches one of const StudentCode variables. The result of this matching would be the thing that adds to the first URL above to be compelted like the second one.

  • The StudentCode object may be fictional, but it is unacceptably fictional if it cannot be parsed. Perhaps drop the square braces? – danh Apr 22 '22 at 14:32
  • What was wrong with [these](https://stackoverflow.com/questions/71953460/i-need-to-allocate-a-url-to-very-student-name-in-javascript) answers? – Aioros Apr 22 '22 at 14:33
  • What does this have to do with "unchanging" or "constant" variables? The question seems to be about generating a URL from a map and some input. How does the title relate to the question? – VLAZ Apr 22 '22 at 14:34
  • It is against stackoverflow's rules to repost the same question, doing so can get you banned from asking questions. – Nick Bailey Apr 22 '22 at 14:41
  • Also your question makes no sense. I don't mean to be harsh, but it's just not readable English. It's clear that English is not your native language, so maybe ask someone you know who's fluent in English how they would phrase the question. – Nick Bailey Apr 22 '22 at 14:43
  • @Aioros I'm sorry but i thought nobody keeps answering and I also had to clear my qustion. So i repeated the question not being aware that it's against the rules. I think here or there there needs to be an answer. And about my English, I apologise. Sorry to offend you NickBailey – mohsen haqiqat Apr 22 '22 at 16:03
  • Dear @VLAZ I need to remind you that cons is a block-based command. So it's containings cannot be redefined. – mohsen haqiqat Apr 22 '22 at 16:04
  • @mohsenhaqiqat no,your reminder is both unnecessary and wrong: `const` *cannot be reassigned*. However, the properties can be changed. [Why can I change a constant object in javascript](https://stackoverflow.com/q/23436437) With that said, `const` does not seem at all related to your question. Nor does it being block-scoped. Again, you seem to be asking how to create a string using a map/object and some input. Whether you've declared the variable as `const` or not is completely irrelevant. You've not clarified how your title matches the question body. – VLAZ Apr 22 '22 at 16:09
  • I haven't declared const as a variable. Can you point at the sentence?!! – mohsen haqiqat Apr 22 '22 at 17:33
  • By the way, I cleared out my question and the question is: how can I assign a variable to every occurrence of l18 to create a url for each student. So every occurrence would be for example Jack whose code in const StudentCode is defined as 32658495 and I need to know how can I define that url which varies depending on each person and is similar in evey link until before the achieved student code out of const StudentCode. It's all because I have no access to l18 so I can change it and this is what's stated in the question title (Unchangeable) and also mentioned (inaccessibility) in the body. :) – mohsen haqiqat Apr 22 '22 at 17:41

0 Answers0