Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8031319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:04:03+00:00 2026-06-05T01:04:03+00:00

i know this function gets a string of valid JavaScript expression or statements and

  • 0

i know this function gets a string of valid JavaScript expression or statements and evaluate the expression or execute the statements, but why we need to pass code to a function for execution instead of simply writing the code in the script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:04:06+00:00Added an answer on June 5, 2026 at 1:04 am

    Let’s say you have functions: makeCheckbox(), makeRadio() and makeSelect() (theoretically). You want to call function by user’s activity (for example menu click). You can make it with if, else if and so on, you can make switch, but you can eval too and make something like:

    eval('make'+userChoose.charAt(0).toUpperCase()+string.slice(1)+'()');
    

    where userChoose is one of the options: radio,checkbox or select, which is first-char-uppercased first and then concatenated with make (before) and () (after), which at the end calls one of the functions.

    This is not good practice because in large projects you can’t simply find callings to function, because they’re “hidden behind” eval, but sometimes it’s the only way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following js code: $(#mySelector).change(function(){ console.log($(this).length); }); I know this is wrong
With this code function someFunction(classParam:Class):Boolean { // how to know if classParam implements some
I don't know why this code is not working: $(window).scroll(function () { var $scrtop
I am trying to pass a String to a native c function but the
I know the prototype and arguements this function takes id class_createInstance(Class cls, size_t extraBytes)
I have this function to read text file with BufferedReader. I want to know
I know this is fairly fundamental stuff. I have a class with a function
Does anyone know how I can reverse this function to produce the original input
I just trying to know is this possible the function of MYSQL GROUP_CONCAT to
So I know I can write my own HTML-encoding function like this: function getHTMLEncode(t)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.