/    Sign up×
Community /Pin to ProfileBookmark

designing a function

Hello
I want to design a function that can three users interested in music, movies and books automatically offer their favorite products but i could not design the proper function
How should I design this function?
Thanks

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@rootSep 08.2017 — You need to give more information about where you are getting your data from.

You also need to be posting the code you have written so we can see what may be going wrong.

When posting code, use forum BBCode tags (see my signature for info) and wrap them around the block of code.
Copy linkTweet thisAlerts:
@sterncoSep 08.2017 — I'm afraid a "function" in the sense we know from php or javascript is not exactly what you are looking for.

To automatically offer products one might be interested in would be a [I]really [/I]complex algorithm that builds heavily on data.
Copy linkTweet thisAlerts:
@NazalislamSep 10.2017 — I think if I'm not wrong, the code goes something like this:


var types = ["music", "movies", "books"];

var interest = prompt("What do you like - music, movies, or books?");

function myFunction(interest) {

if (interest === "music") {

alert("So you like Chris");

}

if (interest === "movies") {

alert("So you like Tom");

}

if (interest === "books") {

alert("So you like JK Rowling");

}

};

myFunction(interest);
[/QUOTE]
Copy linkTweet thisAlerts:
@arnikauthorSep 10.2017 — i just want a example code like we have $a $b and $c we want to show $a to $aa and $b to $bb and $c to $cc just with echo commond

thanks
Copy linkTweet thisAlerts:
@arnikauthorSep 10.2017 — What else do I have? I want to add this ability to my WordPress site, but I did not find a plugin
Copy linkTweet thisAlerts:
@rootSep 10.2017 — Although you can, it is not advisable to use $ prefixes to variables.

Also this is not a code request site, so you would need to provide your code that you are using and explain what errors you are getting (F12 opens / closes the console log) and it also helps to know what it is that the script is meant to do...

When posting code, please use forum BBCode tags as shown in my signature (self explanatory really ) but in case, [B]html[/B] for HTML, [B]php[/B] for PHP and [B]code[/B] for everything else and there is a [B]quote[/B] on when you are quoting something or someone.

If the code it too big, either upload it as a plain text file to the forum or make more than one post remembering to post in reverse order so the two halves will appear in correct order.
×

Success!

Help @arnik spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...