Tag : Loop


How to use foreach object in Nodejs ?

Normally, we does use foreach loop in PHP, JS etc, but when i was working on socket programming at that time i require to use foreach of object in server.js. I did also search on google and try to how to use foreach in Node JS. At last i found to use forEach and solve it. so, let's see following example. <strong >Example</strong> <pre class="prettyprint lang-php"> socket.on("newmessage", function(obj) { obj = JSON.parse(obj); obj.forEach(function(items) { console.log(items.userid); var e = "notify-"+items.userid; io.sockets.emit(e, 1); }); }); </pre>

By Hardik Savani | March 31, 2016 | | 1389 Viewer | Category : PHP Laravel Node JS
READ MORE

    Dynamic Autocomplete search using Bootstrap Typeahead JS Example

    Dynamic Autocomplete search using Bootstrap Typeahead JS Example

    Open Post

    Laravel 5 login with Linkedin using Socialite Package

    Laravel 5 login with Linkedin using Socialite Package

    Open Post

    Jquery select2 ajax autocomplete example with demo in PHP

    Jquery select2 ajax autocomplete example with demo in PHP

    Open Post

    Laravel 5 create and download zip file example using chumper/zipper composer package

    Laravel 5 create and download zip file example using chumper/zipper composer package

    Open Post

    Node JS - Get Real time online users counter using socket io example

    Node JS - Get Real time online users counter using socket io example

    Open Post

    How to get current month records in Laravel 5?

    How to get current month records in Laravel 5?

    Open Post