I am a very beginner in JavaScript and recently I am studying it on a book. I am trying to modify  a script from this book that passes a number which is the number of letters in a word, and output the number of combinations of words you would get by scrambling the letters. While the original script lets you pass the number I want to modify it and allow the user to input a word, take it and return the number of words by scrambling the letters.  My issue is that, when I run the code, I keep getting this error:   Uncaught TypeError: Cannot read property 'length' of undefined     at thingamajig   Why is this happening?  var word = prompt('Word here.');  function thingamajig(word) {     var facky = 1;     clunkCounter = 0; //reset the clunkcounter     if (word.length == 0) {         display("clank");     } else if (word.length == 1) {         display("thunk");     } else {         while (word.length &gt; 1) {             facky = facky * word.length; //multiply facky with size until size is 0. Basically it is caulculating a factorial             word.length = word.length - 1;         }         clunk(facky);     } }  function clunk(times) {     var num = times;     while (num &gt; 0) {         display("clunk"); //keep calling display f until it is = 0         num = num - 1;     } }  function display(output) {     console.log(output);     clunkCounter = clunkCounter + 1; //How many times the clunck f called the display f? }  thingamajig(); console.log(clunkCounter);
What is the scope of variables in javascript? Do they have the same scope inside as opposed to outside a function? Or does it even matter? Also, where are the variables stored if they are defined globally?
How to get ObjectContext to compile? Is it possible to add non-number characters on the left of a code block?  Specifically, I want to add ... to correspond with some source code (see image).    I am currently using commands to stop / start the line numbers. Here is the code:  \documentclass[12pt]{article}  \usepackage[a4paper, margin = 20mm, top = 30mm, bottom = 25mm]{geometry} \usepackage{xcolor, soul} \usepackage{listings}  \definecolor{codebackground}{rgb}{0.95, 0.95, 0.92}  \lstset {     frame            = tb, % hrule above and below     keepspaces       = true,     columns          = flexible,     basicstyle       = {\normalsize\ttfamily},     escapeinside     = {(*@}{@*)}, % for escaping     backgroundcolor  = \color{codebackground},     showstringspaces = false,     language         = C,     keywordstyle     = \color{blue},     stringstyle      = \color{red},     commentstyle     = \color{teal},     numbers          = left, % {none, left, right}     firstnumber      = 1,     numberstyle      = \scriptsize\color{black},     numbersep        = 5pt }  \let\origthelstnumber\thelstnumber \makeatletter % for stopping line numbers \newcommand*\stopnumber {     \lst@AddToHook{OnNewLine}     {         \let\thelstnumber\relax         \advance\c@lstnumber-\@ne\relax     } } % for starting line numbers \newcommand*\startnumber[1] {     \setcounter{lstnumber}{\numexpr#1-1\relax}     \lst@AddToHook{OnNewLine}     {         \let\thelstnumber\origthelstnumber         \refstepcounter{lstnumber}     } } \makeatother  \begin{document} \begin{lstlisting}[firstnumber = 456] int third_function(const int c) {     /* error checking */     if(c &lt; 0)     {         return;     } (*@ \stopnumber @*)      ...     (*@ \startnumber{512} @*)     /* other stuff */     int d = 4;     char* word = "third function"; (*@ \stopnumber @*)      ...     (*@ \startnumber{678} @*)     return (c * d); } \end{lstlisting} \end{document} If $M^n$ is a compact topological manifold (not necessarily with additional structure), is there an upper bound on the number of charts needed to cover $M$ ? Does this bound depend on the dimension of $M$ ?  Thanks in advance...  Cheers I have a set of aerial images which I am trying to clip by their overlapping areas, for use in a more involved program I am writing.  Is there a command line based tool out there with an easy method for extracting the overlapping areas from a pair of images?  The images themselves do not have georeferencing, but they DO come with a shapefile containing bounding boxes of the image collects, as well as IMU data from image collection.  I know this may be difficult since the images will have slight perspective differences, but I was hoping it would still be possible--especially since I am trying to maintain and utilize these perspective differences for something else. How to forward specific log file outside of /var/log with rsyslog to remote server? How can I forward message from a specific log file like /www/myapp/log/test.log with rsyslog client to remote rsyslog server? This log file is outside of the directory /var/log. Using Nouns or Gerunds Error: ! Font OT1/mathkerncmss/m/sl/10.95=mathkerncmssi10 at 10.95pt not loadable: Met ric (TFM) file not found What are the technical obstacles that doesn't allow OSX to be installed in a PC? Prove that $\sin(2A)+\sin(2B)+\sin(2C)=4\sin(A)\sin(B)\sin(C)$ when $A,B,C$ are angles of a triangle Prove that $\sin(2A)+\sin(2B)+\sin(2C)=4\sin(A)\sin(B)\sin(C)$ when $A,B,C$ are angles of a triangle   This question came up in a miscellaneous problem set I have been working on to refresh my memory on several topics I did earlier this year. I have tried changing $4\sin(A)\sin(B)\sin(C)$ to  $$4\sin(B+C)\sin(A+C)\sin(A+B)$$ by making substitutions by reorganizing $A+B+C=\pi$. I then did the same thing to the other side to get $$-2(\sin(B+C)\cos(B+C)+\sin(A+C)\cos(A+C)+\sin(A+B)\cos(A+B))$$ and then tried using the compound angle formula to see if i got an equality. However the whole thing became one huge mess and I didn't seem to get any closer to the solution. I am pretty sure there is some simpler way of proving the equality, but I can't seem to figure it out. Maybe there is a geometric interpretation or maybe it can be done using just algebra and trig. Any hint's would be appreciated (I would prefer an algebraic approach, but it would be nice to see some geometric proofs as well) As title,  Is any finite-dimensional extension of a field, say $F$, algebraic and finitely generated?  Say if $K/F$ is a finite extension when $K$ is a finite-dimensional vector space of $F$. Clearly, this implies that $K$ is finitely generated (as an algebra) over $F$, since a basis is a generating set. So every finite extension is finitely generated.  So indeed they all are, is my logic correct? Bad Character code (256)/ \select@language{greek} What is the difference between "owing to" and "due to"? Invalid SSL certificate when pushing to Git server markdown doesn't work properly How can I deactivate Bluetooth on system startup? How can I deactivate Bluetooth on system startup? Text formatting now allowed in comments (List of proven and disproven abilities) display only 3 foreach result per row Does a photon having superimposed frequencies exist?  (wrt frequency detected by prism or other detectors, not wrt human eye as only rod-cells can detect one photon falling in the detectable (visible) frequency band and the single photon is perceived by eye+brain as grey irrespective of frequency).  Also, with white here, I do not wish to restrict the question implying all VIBGYOR frequencies or only RGB as each color is also a range of frequencies and white to trichromatic-sensor human eye is just output from three frequencies RGB.  Or can it be that materials which slow light down cause a photon of some single frequency and higher energy to split into VIBGYOR? || and the entire spectrum of human eye's detection range is VIBGYOR+W (as monochromatic light of high intensity can also be perceived white by human eye and it is not related to individual color sensors of human eye at all but that above a certain energy per unit volume (referring to detector area of eye cells), we perceive it white, (somewhat but not exactly) similar to combination of red and green which human eye+brain calls yellow.  I have added the additional description to make the question more precise. If my description causes confusion, please stay with the original question and use description just to get an idea of the intent of the question. How can you get the names of method parameters? If I have a method such as:  public void MyMethod(int arg1, string arg2)   How would I go about getting the actual names of the arguments? I can't seem to find anything in the MethodInfo which will actually give me the name of the parameter.  I would like to write a method which looks like this:  public static string GetParamName(MethodInfo method, int index)   So if I called this method with:  string name = GetParamName(MyMethod, 0)   it would return "arg1". Is this possible? I am trying to define an alternative \item command that would allow me to use a different color for some of the items. My code has the following form:  \documentclass{article} \usepackage{color}  \definecolor{gray}{rgb}{0.7,0.7,0.7} \newcommand{\grayitem}[1]{{\color{gray} \item #1}}  \begin{document}  \begin{enumerate} \item First item. \grayitem Second item. \item Third item. \end{enumerate}  \end{document}   I was hoping that  \grayitem Second item.   would produce the same result as  {\color{gray} \item Second item.}   but for some reason, these are not equivalent. They produce the following results, respectively:  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   Why are these two lines of code not equivalent? What am I doing wrong and how can I change the definition of \grayitem to produce the second result?  I have also tried removing a pair of braces, like this  \newcommand{\grayitem}[1]{\color{gray} \item #1}   but then the third item becomes gray as well.  The solution should also work for multi-paragraph items.