Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message.forEach is not a function or some time undefined problem #47

Open
AvanishKumar008 opened this issue May 5, 2016 · 0 comments
Open

Comments

@AvanishKumar008
Copy link

Details['11'] = {
            'id': '11',
            'name': 'Avanish'
        };
res.render('/index',{'Message': Details});

Page code

        <script>
           var ERRORCONST = 'Error';
           var NORECORDS = 'No records';
        </script>

<%if(Message != undefined && Message != NORECORDS && Message != ERRORCONST ){%>
<%Message.forEach(function(key){%>
<span><%= key.id %> - <%= key.name %></span>
<%});%>
<%}%>

Getting error ``NORECORDS is not defined`and print all code on page. I have two error. One is how to use Multiple condition in single if statement and second is how to compare javascript varibale with server variable

if i remove && Message != NORECORDS && Message != ERRORCONST after that getting error forEach not a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant