Issue: Elements of an array are switching places on refresh [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
So, in my admin dashboard, I'm calculating the revenue, and I basically have an array with the last two months and their revenue
But when a refresh the page a few times, the elements in the array change and so does the revenue. Btw I'm getting this income from my api.
Also when I'm trying to fetch the revenue for a particular product, for some reason, it fetches the whole revenue.

It's likely that your API gets the data in random order. Check the data you receive from your API. I think the array will have a different order on different requests.
Also, you should post code in code blocks, not images.

Related

What database should I use in this condition? Or should I use them at all? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I have created a simple project with two HTML page 'home' and 'details'. I have a spreadsheet of some data I want to show as list in 'home' page and on clicking shows associated details. I tried searching in internet but I was left with even more question than before. The data consist of 10 column and 1000 rows and might reach 5000 rows.
If you are facing trouble while learning DataBase, there is an alternative you can try and it is very easy to understand and implement in your code.
You can learn about JSON (JavaScript Object Notation), Simply you have to create a JSON file in which you can store the detail of all those 1000-5000 rows and render them on your Web page using JavaScript

Making a memory game with JavaScript and i need a diferrent way to match cards [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm currently learning JS as a project i decided to make a memory game with the function of connecting questions with answers
currently its matching the cards when they share the same image and for my project I need to make pairs of cards with different images
Could anyone give me an alternative to giving values to the cards, I would like to give classes to the cards manually
return card.getElementsByClassName('card-value')[0].src;
Very easy way is to store values/data using data attributes. Here's a quick overview:
https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes

Write to file in javascript? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have made a simple site that generates random number.
I want to record how many times a specific number comes up.
Is there anyway I can use javascript to write to a Local .txt File on the server?
or do I have to learn PHP?
If you want to keep track of the number of times a random number comes up for a single client/browser, you can use localStorage. If you want to keep track of the number of times the random number occurs across all executions, you'll need some sort of server-side processing.
If you want to avoid any server side processing and this data is critical then you can try GoogleAnalytics code to capture and analyaze the randomly generated data.

Fetching and comparing common likes between two profiles using Facebook API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to fetch and compare commom page likes or another data from facebook between different profiles.
For example, using Tinder, when you are reading about the profiles you can see your common page likes, that's it!
Does anyone has some information about it?
https://developers.facebook.com/docs/graph-api/reference/v2.2/user/likes
A user access token with user_likes permission is required to see all pages liked by that person.
You need to read the user likes of both profiles and match them on your own.
Keep in mind that you need to go through a review process for user_likes.

Make an search engine and get result based on the frequency of search [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to make a search for my website to search the user form my database. Let say I want maybe the most popular or searched user be search priority instead of some no name guy and without using other search engine api/framework. I rather doing this with my finger. So how can i acheive it?I using php for server side ,javascript client side,mysql for database.
In your database add score column and add +1 to it whenever user is visited from search results.
After that simply add ORDER BY score DESC to your query when displaying results.

Categories