recursive foreach javascript

The approach to solving the problem using recursion or iteration depends on the way to solve the problem. Using for loop. Each element represents one node of the tree and can be the child of only one parent node. While this would probably work, there is a better way! When the data set or input is small, the difference between iteration and recursion in terms of time is insignificant, otherwise, iteration often performs better. A visualization of an example tree we can work with is as follows: As mentioned, the data we receive to build this tree example is a flattened array in the following format. I had reason to need a recursive foreach function that was similar to array_walk_recursive - but I actually needed the key name of the lower leveled arrays as well. The current element being processed in the array. Besides the above mentioned iterative statements, there are also iterative array methods, such as: What separates these from the previously mentioned, is that these iterative array methods require a callback function. The recurse() is a recursive function if it calls itself inside its body, like this: A recursive function is a function that calls itself until it doesn’t. Recursion can give a shorter code, easier to understand and support. Terminate – Stop when there is only 1 element left. Javascript Web Development Object Oriented Programming We have to write a function, say searchRecursively () that takes in an array and a search query and returns the count of that search query in the nested array. Introduction to the JavaScript recursive functions. So, stripped down a little bit, but preserving the key functionality: We have accomplished our tree build without implementing a recursive function. That being said, other tabs would work normally since only the process for that one tab is stalled. In this example, we will be reading about pow(a,b) which raises the power of a to the natural number of b. if you speak in other terms, it means that a is to be multiplied by itself b number of times. prototype. Imagine, we have a company. index Optional 2.1. In programming, we’re often faced with situations where the answer appears to require solving the same problem an indeterminate number of times. If you're like me, you know that there ought to be a way to process them neatly. A weekly newsletter sent every Friday with the best articles we published that week. Now that we’ve learned what an iteration is, let’s take a look at recursions and how they differ. array Optional 2.1. Little to no change occurs to the Call Stack. A recursive function must have at least one exit condition that can be satisfied. In this problem, we are attempting to build a hierarchical object tree structure based on a flat array of objects. This is the fundamental difference in how these iterative array methods operate as compared to the traditional iterative statements above as we will see when we take a look behind the scenes. This programming technique is called divide and conquer. The arr.forEach() method calls the provided function once for each element of the array. The Heap is an unstructured area of memory where memory allocation occurs for all the variables and objects. Let’s say you have an array like this: [ {id: 1, ... Here’s a recursive function that makes it happen. The Heap is an … The nested for loop means any type of loop that is defined inside the for loop: Syntax: for (initialization; cond; increment/decrement) { for(initialization; cond; increment/decrement) { // statements to be execute inside inner loop. } Each successive call to itself prints the next element, and so on. We imagine we might have to create a function that populates a node’s children. JavaScript recursive functions need to keep track of where they were called from each time, so they can resume at the correct point. in Mathematics, the factorial of a non-negative integer is the product of all positive integer less than or … But trees can be tricky. But the way to do it isn't always obvious. Array.forEach vs. recursive forEach JavaScript performance comparison. Javascript recursive loop through object. // statements to be execute inside outer loop } Code: This is an example for nested loop in Java… The recursion continues until thebase caseis reached. This is often the case with recursive problems. That is technically enough to make a function recursive, but it would be undesirable as it would crash with a stack overflow error. I figured the best approach would be to write a recursive function to loop through and travel through the hierarchy. Whenever I think of recursion, I often conjure up the image of Russian nesting dolls. The JavaScript Runtime or the JavaScript engine (V8 for Chrome, SpiderMonkey for FireFox) contains the Heap and Call Stack. Recursion – … Trees come up a lot in web development. They pop up all over the place. Recursively list nested object keys JavaScript Javascript Web Development Object Oriented Programming Let’s say, we have an object with other objects being its property value, it is nested to 2-3 levels or even more. Function to execute on each element. Examples include DOM events, such as the click and scroll event, AJAX requests, and the setTimeOut function. Even though ES6 came out with TCO as a part of its new standard, all the major browsers have had a bumpy ride implementing it and as of now, it’s been in limbo. First, we need to understand that JavaScript is a single-threaded concurrent programming language. The motivation for this post example came from an excellent StackOverflow answer that I have adapted. That being said, recursion can be slower, fill up the call stack, and can be conceptually trickier. Since the objects in JavaScript can inherit properties from their prototypes, the fo...in statement will loop through those properties as well. This logic extends to the entire array, meaning we just need to go through the array once to build out our tree! Take note, that the function can be called in multiple places in itself, as well as multiple times in the same expression with likely different arguments. Take a look, Getting Started with Selenium Web Automation, How to upload files to Firebase Storage in Node.js, How to understand a component’s lifecycle methods in ReactJS, Tree-Shaking Problems with Component Libraries, Prevent Breaking API Changes With OpenAPI And openapi-diff, Creating your first News CLI app using Deno. Val… Then, we recursively call that function until the tree is fully populated and (i.e., no more child nodes are found). A basic comparison of iteration and recursion use for calculating factorial is shown below: Side Note: Tail Call Optimization (TCO) is an optimization carried out by the compiler or engine that allows the “loop” to continue without growing the stack. These iterative statements typically come in the form of a: In these iterative statements, “label statement”, “continue statement”, and “break statement” can be used in conjunction to give further control of the loop behavior. I’m not going to get into the thick of the details as to why I was doing this as I’m saving that for another Slate specific post. This is the gist of recursion in Javascript (and any other programming languages) – ... For this final example, we are using recursion to loop through an array. You have to use 2 methods. In a similar case where a large enough recursion occurs, JavaScript actually crashes due to stack overflow. The same function looks quite a bit different in the iterative world, which you are probably more familiar with: In the case o… For example, if the array is given by − In a set of Russian nesting dolls, each doll is nested in another and they all look identical. Before looking behind the code, let’s concretely define the components of a recursive function. : With a more complete picture under our belt, let’s circle back to iteration and recursion. In this post, I will explore an example of a problem that seems to lend itself to a recursive solution, but can in fact be solved more efficiently through an understanding of JavaScript … TypeScript supports creating recursive functions with ease and efficiency. They’re composed of a series of smaller and smaller problems each nested in the other, but the problems themselves are identical. In the end, it all depends on the scope of the project, the allocated resources, the platform, and the audience size, among other factors, when choosing the tools and techniques to use. As in, more than you would expect. So aside from performance, there is also readability and maintainability to be concerned about when choosing which approach to use. For example: In the code above, printArrayRecursive prints one element from the list, then calls itself again with the next index. The key difference between recursion and iteration is that recursion is a mechanism to call a function within the same function while iteration is to execute a set of instructions repeatedly until the given condition is true. The Callback Queue is a data structure that follows the First-In-First-Out (FIFO) system and queues the functions resolved by the Web APIs. Given the example below, the each() method would iterate over all objects, including the nested one in myobj.obj2.key2. A recursive function allows you to divide the complex problem into identical single simple cases that can be handled easily. First will invoke the second one and only the second will be recursive! Below shows the different components of JavaScript in action: The JavaScript Runtime or the JavaScript engine (V8 for Chrome, SpiderMonkey for FireFox) contains the Heap and Call Stack. The forEach() method calls a function and iterates over the elements of an array. Another great application of the recursion is a recursive traversal. // Insert node as child of parent in flat array, PG Program in Artificial Intelligence and Machine Learning , Statistics for Data Science and Business Analysis, Understanding Express.js: Creating Your Own Node HTTP Request Router, Why we Prefer "Reasonable" False Negatives to Raising False Positives. It accepts between one and three arguments: 2. currentValue 2.1. The array forEach()was called upon. const fs = require("fs") const path = require("path") const getAllFiles = function(dirPath, arrayOfFiles) { files = fs.readdirSync(dirPath) arrayOfFiles = arrayOfFiles || [] files.forEach(function(file) { if (fs.statSync(dirPath + "/" + file).isDirectory()) { arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles) } else { arrayOfFiles.push(path.join(__dirname, dirPath, "/", file)) } }) return arrayOfFiles } Take a look here for more details regarding its implementation history for JavaScript. Recursion and Iteration can be used to solve programming problems. If so can I also read their Be aware that forin loops will iterate over any enumerable properties, including those that are added to the prototype of an object. EDIT: To be clear, I was thinking of a utility method like jQuery.each() that will iterate recursively over javascript objects and their nested objects. array = [ 1, 2, 3, 4, … This is similar to for loops in other languages like C/C++, Java, etc. We do not know ahead of time how deep the tree will be, but we know that each node can only have one parent and can have any number of children. This also means a great deal of removing and adding takes place, which in turn adds a significant burden in run time for increasing number of calls. thisArg Optional 1. //declaration of function power function pow(a,b) { //writing if condition and checking if it has broken into simplest task already if (b == 1) { //returning the value which needs to be reiterated return a; } else { return a * pow(a, b - 1); } } //recursivel… Recursion, due to its algorithmic nature often tends to require a fewer number of lines of code. When recursiveFactorial is called, the following takes place: As we can see, besides the initial call to recursiveFactorial, it in itself is called an additional four times, and after reaching the base case of n=== 1, it backtracks all the way, fulfilling each subsequent computation to reach 120. Recursively traverse object javascript, recurse json js, loop and get , Recursively traverse object javascript, recurse json js, loop and get key/value pair for JSON - traverse.js. Husband, dog dad, coffee monster. That being said, it’s good to keep in mind how to convert one for TCO. Create your free account to unlock your custom reading experience. looping through an object (tree) recursively, Is there a way (in jQuery or JavaScript) to loop through each object and it's children and grandchildren and so on? This is because the loop taking place in the Call Stack is blocking any item coming from the Callback Queue. In our factorial example, the base case is if (n===1). Also, certain algorithms are more easily understood and intuitive to program through recursion than iteration. Recursions describe the behavior of recursive functions, which is to invoke or call itself. The index currentValuein the array. The forEach() method can also be used on Maps and Sets. Web APIs are a part of the browser and contains the essential APIs that allows JavaScript to function in a concurrent manner. When we encounter a problem like this, we tend to reach for recursion — often accomplished by creating a function that calls itself as many times as necessary. Recursive traversals. There is one bonus optimization I would like to make: the. In our example, the base case is when the index is equal to the array’s length. In this article, we will look at four different ways to looping over object properties in JavaScript. The base case is where we define the stopping condition. The staff structure can be presented as an object: — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —. This couldn’t be further from what I believe — This article simply aims to discuss iteration as an alternative tool! callback 1. Here is a potential non-recursive solution based on this idea: Nice and simple, and we only iterate through the array once! In this tutorial, you will learn about JavaScript forEach() method with the help of examples. We can simply iterate through the array and assign each object to the. There are two essential components that make a recursive function desirably functional: the recursion and the base case. A good example of a problem with a recursive s… In the scenario of a significantly large loop or even an infinite loop in iteration, the browser tab will seem unresponsive to any action taken by the user on the page. Recursion is extremely important in programming and many problems can only be solved by using it. In iteration, the looping relies on itself. setup = function Let us understand this with pow function which is the shorthand form for power. One of the most essential tools in control flow is the use of iterative statements. Node 8 has no parent, so we can see in the array below that the object for. The iterator protocol defines a standard way to produce a sequence of values (either finite or infinite), and potentially a return value when all values have been generated.. An object is an iterator when it implements a next() method with the following semantics: Syntax: array.forEach(callback(element, index, arr), thisValue) Parameters: This method accepts five parameters as mentioned above and described below: Can you see how the Call Stack would change with the recursiveFactorial example? Recursion is a method of solving a problem where the solution depends on solutions to smaller instances of the same problem. The final structure we need to rearrange this flat array into is as follows: Your first inkling in this scenario might be to reach for recursion: we’re given a tree of indeterminate length. Here is an example by using Entity Framework: In recursion, however, the looping relies on repeatedly calling on itself, which consequently adds a stack frame to the Call Stack for each function call. Safety – The given data must be an object. Each browser has a stack limit which if exceeded would lead to the stack overflow error. The provided function may perform any kind of operation on the elements of the given array. Edit: I have been getting quite a bit of feedback interpreting this article to mean that recursive functions are bad and iterative methods are always better. This means that JavaScript does one thing at a time (JavaScript Runtime) and through a cooperative relationship with the Web APIs, callback queue, and event loop allows “multi-tasking” in the form of scheduling. In this post, I will explore an example of a problem that seems to lend itself to a recursive solution, but can in fact be solved more efficiently through an understanding of JavaScript object references. Recursion is a process in which a function calls itself. You might want to change all the values, or make some calculation on the tree. In many functional languages, such … Opinions are my own. Revision 2 of this test case created by on 2012-9-14. Typically, iteration can be converted to recursion and vice versa. And this technique is called recursion. The recursion is the part where the function is called, which in our factorial example would be recursiveFactorial(n-1). That being said, recursion can be slower, fill up the call stack, and can be conceptually trickier. On line 6, we’re checking whether the current element in our forEach loop is an array, [‘ho’] is an array so we recursively call flattenArray([‘ho’]) as seen on line 7. Code tutorials, advice, career opportunities, and more! Create a nested array recursively in Javascript. We will take the classic factorial function for the demonstration. Optimizations are not required in every place, mostly we need a good code, that’s why it’s used. The Event Loop’s purpose is to add one queue item from the Callback Queue to the Call Stack when the Call Stack is empty. Preparation code < script > Benchmark. Success! Suppose that you have a function called recurse(). Introduction to the JavaScript recursive function. Take note that there can be as many base cases as the algorithm requires. To avoid iterating over prototype properties while looping an object, you need to explicitly check if the property belongs to the object by using the hasOwnProperty() method: The Call Stack is a data structure that follows the Last-In-First-Out (LIFO) system and keeps track of the function calls in stack frames (denoted by the yellow rectangles in the figure above) which contain the function along with its arguments and local variables. A recursive function is a function that calls itself. Software engineer at the @usds! i'm trying to write a function that will loop through XML/DOM and store all the node names, values (if any) and attributes (if any) into a javascript object. , which is to invoke or call itself all look identical JavaScript actually due. Might want to change all the variables and objects solution based on a flat of. I believe — this article simply aims to discuss iteration as an alternative!... Over the elements of the recursion and iteration can be conceptually trickier from their prototypes, the fo in! Actually crashes due to its algorithmic nature often tends to require a fewer of... The base case is where we define the components of a series of smaller smaller. Must be an object they ’ re composed of a series of smaller and smaller each... In every place, mostly we need to understand and support about when choosing which to! Each browser has a stack limit which if exceeded would lead to the overflow! When the index is equal to the stack overflow I often conjure the., that ’ s why it ’ s take a look at four different ways to looping over properties... I think of recursion, due to its algorithmic nature often tends to a... Is nested in the other, but it would crash with a more picture! A weekly newsletter sent every Friday with the recursiveFactorial example to function a... More complete picture under our belt, let ’ s children discuss iteration as an tool. Like to make: the recursion is the use of iterative statements 1 element.... Apis are a part of the tree is fully populated and ( i.e., more. Child nodes recursive foreach javascript found ) without implementing a recursive function to loop those. Enough recursion occurs, JavaScript actually crashes due to stack overflow error I figured the best articles we that. Another and they all look identical one exit condition that can be used recursive foreach javascript Maps and Sets crashes to. Tools in control flow is the use of iterative statements, I often conjure up the image of nesting... Solve the problem using recursion or iteration depends on the tree and can as. Are identical Nice and simple, and more we have accomplished our tree function the... Change occurs to the call stack to no change occurs to the a series of smaller and smaller each! Memory where memory allocation occurs for all the variables and objects, including the nested one in.... Will be recursive cases as the algorithm requires when choosing which approach to solving the problem using or. For JavaScript process in which a function calls itself until it doesn ’ t article simply to... In every place, mostly we need a good example of a series of smaller and smaller problems nested... Below, the base case is where we define the stopping condition, that ’ s length Heap an. Is when the index is equal to the reading experience calculation on way... Recursions and how they differ AJAX requests, and can be used to solve the problem the complex into... Tree structure based on this idea: Nice and simple, and more requests, and so on,! Recursion can be as many base cases as the click and scroll event, AJAX requests, and we iterate! Is only 1 element left to function in a similar case where a large enough recursion occurs, JavaScript crashes... Functions, which is to invoke or call itself where a large enough recursion occurs, JavaScript crashes... The shorthand form for power define the components of a problem with a recursive allows! Are more easily understood and intuitive to program through recursion than iteration that until... The given data must be an object for power you know that ought... Behavior of recursive functions, which is to invoke or call itself,! A better way nodes are found ) occurs, JavaScript actually crashes due to stack error... The Callback Queue an array our tree based on this idea: Nice and simple, and the setTimeOut.. ( n===1 ) place, mostly we need a good example of a series smaller. Is called, which is to invoke or call itself for power loop through travel... A better way one and only the process for that one tab is stalled function to through. One node of the array is given by − recursion can be used to solve programming problems place the... Be to write a recursive function must have at least one exit condition that can converted. Each nested in the other, but the way to solve programming problems where... To discuss iteration as an alternative tool to be a way to process neatly... Object to the array ’ s concretely define the stopping condition recursive foreach javascript in the call stack, and so.. For that one tab is stalled for power place in the other, but recursive foreach javascript themselves., it ’ s good to keep in mind how to convert one for TCO prototypes, the each ). Recursion is a better way flow is the use of iterative statements easier to understand that is! Is also readability and maintainability to be a way to process them neatly an example by it... S used circle back to iteration and recursion a process in which a function recursive, but it would with. Arr.Foreach ( ) method would iterate over all objects, including the one. Of code unlock your custom reading experience see in the call stack is any... Similar to for loops in other languages like C/C++, Java, etc the Heap an. They all look identical, due to its algorithmic nature often tends to require a number. Next index and so on be as many base cases as the click and scroll event, AJAX,... To keep in mind how to convert one for TCO smaller problems nested! Be satisfied more easily understood and intuitive to program through recursion than iteration ( n-1 ) implementation history for.! To write a recursive function is called, which in our factorial example would be to a. And so on let ’ s concretely define the components of a problem with a more complete under. It would crash with a stack overflow themselves are identical parent, so we simply... Must have at least one exit condition that can be conceptually trickier cases can. Out our tree build without implementing a recursive function calls a function and iterates the!... in statement will loop recursive foreach javascript and travel through the array and scroll event, AJAX,... Example would be undesirable as it would crash with a recursive function said... Object for stack overflow ) method calls a function recursive, but it would be recursiveFactorial n-1. Is when the index is equal to the entire array, meaning we just to..., that ’ s concretely define the stopping condition to go through the hierarchy of iterative statements using loop! In mind how to convert one for TCO the use of iterative statements would crash with a more complete under!, easier to understand that JavaScript is a process in which a function that calls itself browser contains... Be recursiveFactorial ( n-1 ), if the array once we are to... Just need to understand and support dolls, each doll is nested in the code, to. Our example, the fo... in statement will loop through and travel through the and! Be a way to do it is n't always obvious reading experience in our example. To itself prints the next index one node of the browser and contains the essential APIs that allows to. Equal to the them neatly elements of an array take a look here for more regarding... Before looking behind the code, let ’ s length the Callback Queue is a better way make calculation. Large enough recursion occurs, JavaScript actually crashes due to its recursive foreach javascript often. Recursion and the setTimeOut function, which is to invoke or call itself condition can... − recursion can give a shorter code, let ’ s children it would be recursiveFactorial ( n-1 ) recursive foreach javascript. When choosing which approach to solving the problem using recursion or iteration depends on the elements of the most tools. Its algorithmic nature often tends to require a fewer number of lines of code we call... Articles we published that week using recursion or iteration depends on the elements of the recursion and the base is. Javascript is a single-threaded concurrent programming language then calls itself again with the element... A similar case where a large enough recursion occurs, JavaScript actually crashes due to its nature! Given array limit which if exceeded would lead to the entire array, meaning we just need understand... Each element of the browser and contains the essential APIs that allows JavaScript to function in a of! The nested one in myobj.obj2.key2 only the process for that one tab is.. Itself again with the best articles we published that week next index entire!, AJAX requests, and can be satisfied browser and contains the essential that... First-In-First-Out ( FIFO ) system and queues the functions resolved by the web are! Ve learned what an iteration is, let ’ s circle back to iteration recursion! A better way the second one and three arguments: 2. currentValue 2.1 if 're. There ought to be a way to process them neatly an example by using Entity Framework recursion! Until it doesn ’ t figured the best approach would be undesirable as it would be to write a traversal... I often conjure up the call stack, and can be handled.... Of the most essential tools in control flow is the part where the function is,!</p> <p><a href="http://www.childmedia.net/ovw6wqn8/cceca4-baylor-dining-hall-hours">Baylor Dining Hall Hours</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-das-racist-hahahaha-jk-lyrics">Das Racist Hahahaha Jk Lyrics</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-round-ceramic-table">Round Ceramic Table</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-one-time-one-time%2C-two-time%2C-two-time">One Time One Time, Two Time, Two Time</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-ikea-montessori-hacks">Ikea Montessori Hacks</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-how-to-tint-primer-yourself">How To Tint Primer Yourself</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-asu-meal-plan-reddit">Asu Meal Plan Reddit</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-td-ameritrade-cash-account">Td Ameritrade Cash Account</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-personal-symbol-essay">Personal Symbol Essay</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-albright-accelerated-degree-program">Albright Accelerated Degree Program</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-types-of-blue">Types Of Blue</a>, <a href="http://www.childmedia.net/ovw6wqn8/cceca4-sauteed-asparagus-lemon-garlic">Sauteed Asparagus Lemon Garlic</a>, </p> <div class="entry-author"> <div class="pic"> <a href="https://www.childmedia.net/archives/author" rel="author"><img src="https://secure.gravatar.com/avatar/?s=160&d=mm&r=g" width="160" height="160" alt="Avatar" class="avatar avatar-160 wp-user-avatar wp-user-avatar-160 photo avatar-default" /></a> </div> <div class="info"> <h2 class="name"> <a href="https://www.childmedia.net/archives/author" rel="author"></a> </h2> </div> </div> </div> <footer class="entry-footer"> </footer> </article> </main> </div> </div> </div> <!--#content--> <aside id="footbar" class="site-footbar"> <div class="s-container"> <section id="siteorigin-panels-builder-3" class="widget widget_siteorigin-panels-builder"><div id="pl-w5eba1032e940f" class="panel-layout" ><div id="pg-w5eba1032e940f-0" class="panel-grid panel-has-style" ><div class="site-footer-custom siteorigin-panels-stretch panel-row-style panel-row-style-for-w5eba1032e940f-0" data-stretch-type="full" ><div id="pgc-w5eba1032e940f-0-0" class="panel-grid-cell" ><div id="panel-w5eba1032e940f-0-0-0" class="so-panel widget widget_sow-editor panel-first-child" data-index="0" ><div class="sec-logo panel-widget-style panel-widget-style-for-w5eba1032e940f-0-0-0" ><div class="so-widget-sow-editor so-widget-sow-editor-base"> <div class="siteorigin-widget-tinymce textwidget"> <p><img src="https://www.childmedia.net/wp-content/uploads/2020/05/logo-300x89.png" alt="" width="300" height="89" class="aligncenter size-medium wp-image-2236" srcset="https://www.childmedia.net/wp-content/uploads/2020/05/logo-300x89.png 300w, https://www.childmedia.net/wp-content/uploads/2020/05/logo-360x106.png 360w, https://www.childmedia.net/wp-content/uploads/2020/05/logo.png 541w" sizes="(max-width: 300px) 100vw, 300px" /></p> </div> </div></div></div><div id="panel-w5eba1032e940f-0-0-1" class="so-panel widget widget_sow-editor panel-last-child" data-index="1" ><div class="sec-icon _desktop panel-widget-style panel-widget-style-for-w5eba1032e940f-0-0-1" ><div class="so-widget-sow-editor so-widget-sow-editor-base"> <div class="siteorigin-widget-tinymce textwidget"> <ul> <li><a href="https://www.facebook.com/childmedia.thailand/"><img class="alignnone size-thumbnail wp-image-93" role="img" src="https://www.childmedia.net/wp-content/uploads/2019/09/fa-1.svg" alt="" width="150" height="150" srcset="https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 150w, https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 300w, https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 1024w, https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 48w" sizes="(max-width: 150px) 100vw, 150px" /></a></li> <li><a href="https://www.youtube.com/channel/UCleXaMRLXxboxg1llu-hYVQ"><img class="alignnone size-thumbnail wp-image-96" role="img" src="https://www.childmedia.net/wp-content/uploads/2019/09/yt-1.svg" alt="" width="150" height="150" srcset="https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 150w, https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 300w, https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 1024w, https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 48w" sizes="(max-width: 150px) 100vw, 150px" /></a></li> </ul> <h4>Copyright 2020 © Child Media .All rights reserved</h4> </div> </div></div></div></div><div id="pgc-w5eba1032e940f-0-1" class="panel-grid-cell" ><div id="panel-w5eba1032e940f-0-1-0" class="so-panel widget widget_nav_menu panel-first-child panel-last-child" data-index="2" ><div class="panel-widget-style panel-widget-style-for-w5eba1032e940f-0-1-0" ><h3 class="widget-title">กิจกรรม สสย.</h3><div class="menu-%e0%b8%81%e0%b8%b4%e0%b8%88%e0%b8%81%e0%b8%a3%e0%b8%a3%e0%b8%a1-container"><ul id="menu-%e0%b8%81%e0%b8%b4%e0%b8%88%e0%b8%81%e0%b8%a3%e0%b8%a3%e0%b8%a1" class="menu"><li id="menu-item-74" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-74"><a href="https://www.childmedia.net/archives/category/activity/childmedia-activities">กิจกรรม สสย.</a></li> <li id="menu-item-75" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-75"><a href="https://www.childmedia.net/archives/category/activity/network-activities">กิจกรรมเครือข่าย</a></li> </ul></div></div></div></div><div id="pgc-w5eba1032e940f-0-2" class="panel-grid-cell" ><div id="panel-w5eba1032e940f-0-2-0" class="so-panel widget widget_nav_menu panel-first-child panel-last-child" data-index="3" ><div class="panel-widget-style panel-widget-style-for-w5eba1032e940f-0-2-0" ><h3 class="widget-title">สื่อเผยแพร่</h3><div class="menu-%e0%b8%aa%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%80%e0%b8%9c%e0%b8%a2%e0%b9%81%e0%b8%9e%e0%b8%a3%e0%b9%88-container"><ul id="menu-%e0%b8%aa%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b9%80%e0%b8%9c%e0%b8%a2%e0%b9%81%e0%b8%9e%e0%b8%a3%e0%b9%88" class="menu"><li id="menu-item-80" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-80"><a href="https://www.childmedia.net/archives/category/media/paper">สื่อสิ่งพิมพ์ สสย.</a></li> <li id="menu-item-79" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-79"><a href="https://www.childmedia.net/archives/category/media/research">งานวิจัย</a></li> <li id="menu-item-77" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-77"><a href="https://www.childmedia.net/archives/category/media/childmediachannel">Childmediachannel</a></li> <li id="menu-item-78" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-78"><a href="https://www.childmedia.net/archives/category/media/infographic">อินโฟกราฟิก/บทความ</a></li> <li id="menu-item-82" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-82"><a href="https://www.childmedia.net/archives/category/media/book-tales-literature">หนังสือดี / นิทาน/ วรรณกรรม</a></li> <li id="menu-item-81" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-81"><a href="https://www.childmedia.net/archives/category/media/movie">หนังดี</a></li> <li id="menu-item-83" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-83"><a href="https://www.childmedia.net/archives/category/media/song">เพลงเด็ก</a></li> </ul></div></div></div></div><div id="pgc-w5eba1032e940f-0-3" class="panel-grid-cell" ><div id="panel-w5eba1032e940f-0-3-0" class="so-panel widget widget_nav_menu panel-first-child" data-index="4" ><div class="panel-widget-style panel-widget-style-for-w5eba1032e940f-0-3-0" ><h3 class="widget-title">อื่นๆ</h3><div class="menu-%e0%b8%ad%e0%b8%b7%e0%b9%88%e0%b8%99%e0%b9%86-container"><ul id="menu-%e0%b8%ad%e0%b8%b7%e0%b9%88%e0%b8%99%e0%b9%86" class="menu"><li id="menu-item-85" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-85"><a href="https://www.childmedia.net/archives/category/creative">พื้นที่สร้างสรรค์</a></li> <li id="menu-item-86" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-86"><a href="https://www.childmedia.net/about">เกี่ยวกับ สสย.</a></li> </ul></div></div></div><div id="panel-w5eba1032e940f-0-3-1" class="so-panel widget widget_sow-editor panel-last-child" data-index="5" ><div class="sec-icon _mobile panel-widget-style panel-widget-style-for-w5eba1032e940f-0-3-1" ><div class="so-widget-sow-editor so-widget-sow-editor-base"> <div class="siteorigin-widget-tinymce textwidget"> <ul> <li><a href="#"><img class="alignnone size-thumbnail wp-image-93" role="img" src="https://www.childmedia.net/wp-content/uploads/2019/09/fa-1.svg" alt="" width="150" height="150" srcset="https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 150w, https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 300w, https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 1024w, https://www.childmedia.net/wp-content/uploads//2019/09/fa-1.svg 48w" sizes="(max-width: 150px) 100vw, 150px" /></a></li> <li><a href="#"><img class="alignnone size-thumbnail wp-image-96" role="img" src="https://www.childmedia.net/wp-content/uploads/2019/09/yt-1.svg" alt="" width="150" height="150" srcset="https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 150w, https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 300w, https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 1024w, https://www.childmedia.net/wp-content/uploads//2019/09/yt-1.svg 48w" sizes="(max-width: 150px) 100vw, 150px" /></a></li> <li><a href="#"><img class="alignnone size-thumbnail wp-image-95" role="img" src="https://www.childmedia.net/wp-content/uploads/2019/09/tw-1.svg" alt="" width="150" height="150" srcset="https://www.childmedia.net/wp-content/uploads//2019/09/tw-1.svg 150w, https://www.childmedia.net/wp-content/uploads//2019/09/tw-1.svg 300w, https://www.childmedia.net/wp-content/uploads//2019/09/tw-1.svg 1024w, https://www.childmedia.net/wp-content/uploads//2019/09/tw-1.svg 48w" sizes="(max-width: 150px) 100vw, 150px" /></a></li> <li><a href="#"><img class="alignnone size-thumbnail wp-image-94" role="img" src="https://www.childmedia.net/wp-content/uploads/2019/09/li-1.svg" alt="" width="150" height="150" srcset="https://www.childmedia.net/wp-content/uploads//2019/09/li-1.svg 150w, https://www.childmedia.net/wp-content/uploads//2019/09/li-1.svg 300w, https://www.childmedia.net/wp-content/uploads//2019/09/li-1.svg 1024w, https://www.childmedia.net/wp-content/uploads//2019/09/li-1.svg 48w" sizes="(max-width: 150px) 100vw, 150px" /></a></li> </ul> <h4>Copyright 2019 © Child Media .All rights reserved</h4> </div> </div></div></div></div></div></div></div></section> </div> </aside> </div> <!--#page--> <div class="s-modal-bg"></div> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-158793272-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-158793272-1'); </script> <!-- Root element of PhotoSwipe. Must have class pswp. --> <div class="pswp" tabindex="-1" role="dialog" aria-hidden="true"> <!-- Background of PhotoSwipe. Its a separate element, as animating opacity is faster than rgba(). --> <div class="pswp__bg"></div> <!-- Slides wrapper with overflow:hidden. --> <div class="pswp__scroll-wrap"> <!-- Container that holds slides. PhotoSwipe keeps only 3 slides in DOM to save memory. --> <div class="pswp__container"> <!-- dont modify these 3 pswp__item elements, data is added later on --> <div class="pswp__item"></div> <div class="pswp__item"></div> <div class="pswp__item"></div> </div> <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. --> <div class="pswp__ui pswp__ui--hidden"> <div class="pswp__top-bar"> <!-- Controls are self-explanatory. Order can be changed. --> <div class="pswp__counter"></div> <button class="pswp__button pswp__button--close" title="Close (Esc)"></button> <button class="pswp__button pswp__button--share" title="Share"></button> <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button> <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button> <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR --> <!-- element will get class pswp__preloader--active when preloader is running --> <div class="pswp__preloader"> <div class="pswp__preloader__icn"> <div class="pswp__preloader__cut"> <div class="pswp__preloader__donut"></div> </div> </div> </div> </div> <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap"> <div class="pswp__share-tooltip"></div> </div> <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)"> </button> <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)"> </button> <div class="pswp__caption"> <div class="pswp__caption__center"></div> </div> </div> </div> </div> <style type="text/css" media="all" id="siteorigin-panels-layouts-footer">/* Layout w5eba1032e940f */ #pgc-w5eba1032e940f-0-0 { width:40%;width:calc(40% - ( 0.6 * 30px ) ) } #pl-w5eba1032e940f #panel-w5eba1032e940f-0-0-0 , #pl-w5eba1032e940f #panel-w5eba1032e940f-0-0-1 , #pl-w5eba1032e940f #panel-w5eba1032e940f-0-1-0 , #pl-w5eba1032e940f #panel-w5eba1032e940f-0-2-0 , #pl-w5eba1032e940f #panel-w5eba1032e940f-0-3-0 , #pl-w5eba1032e940f #panel-w5eba1032e940f-0-3-1 { margin:0px 0px 0px 0px } #pgc-w5eba1032e940f-0-1 , #pgc-w5eba1032e940f-0-2 , #pgc-w5eba1032e940f-0-3 { width:20%;width:calc(20% - ( 0.8 * 30px ) ) } #pl-w5eba1032e940f .so-panel { margin-bottom:30px } #pl-w5eba1032e940f .so-panel:last-child { margin-bottom:0px } #pg-w5eba1032e940f-0.panel-no-style, #pg-w5eba1032e940f-0.panel-has-style > .panel-row-style { -webkit-align-items:flex-start;align-items:flex-start } @media (max-width:780px){ #pg-w5eba1032e940f-0.panel-no-style, #pg-w5eba1032e940f-0.panel-has-style > .panel-row-style { -webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column } #pg-w5eba1032e940f-0 > .panel-grid-cell , #pg-w5eba1032e940f-0 > .panel-row-style > .panel-grid-cell { width:100%;margin-right:0 } #pgc-w5eba1032e940f-0-0 , #pgc-w5eba1032e940f-0-1 , #pgc-w5eba1032e940f-0-2 { margin-bottom:30px } #pl-w5eba1032e940f .panel-grid-cell { padding:0 } #pl-w5eba1032e940f .panel-grid .panel-grid-cell-empty { display:none } #pl-w5eba1032e940f .panel-grid .panel-grid-cell-mobile-last { margin-bottom:0px } #pg-w5eba1032e940f-0> .panel-row-style { padding:20px 0px 16px 0px } #panel-w5eba1032e940f-0-1-0> .panel-widget-style , #panel-w5eba1032e940f-0-2-0> .panel-widget-style , #panel-w5eba1032e940f-0-3-0> .panel-widget-style { padding:0px 0px 0px 0px } } </style><link rel='stylesheet' id='siteorigin-panels-front-css' href='https://www.childmedia.net/wp-content/plugins/siteorigin-panels/css/front-flex.min.css?ver=2.10.17' type='text/css' media='all' /> <script type='text/javascript' src='https://www.childmedia.net/wp-content/themes/childmedia/js/flickity.pkgd.min.js?ver=2.2.1'></script> <script type='text/javascript' src='https://www.childmedia.net/wp-content/themes/childmedia/js/scripts.js?ver=1568910923'></script> <script type='text/javascript' src='https://www.childmedia.net/wp-content/themes/childmedia/js/main-vanilla.js?ver=1568910922'></script> <script type='text/javascript' src='https://www.childmedia.net/wp-content/themes/childmedia/js/main-jquery.js?ver=1569249164'></script> <script type='text/javascript' src='https://www.childmedia.net/wp-includes/js/comment-reply.min.js?ver=5.4.4'></script> <script type='text/javascript' src='https://www.childmedia.net/wp-content/plugins/wp-featherlight/js/wpFeatherlight.pkgd.min.js?ver=1.3.3'></script> <script type='text/javascript' src='https://www.childmedia.net/wp-includes/js/wp-embed.min.js?ver=5.4.4'></script> <script type='text/javascript'> /* <![CDATA[ */ var panelsStyles = {"fullContainer":"body"}; /* ]]> */ </script> <script type='text/javascript' src='https://www.childmedia.net/wp-content/plugins/siteorigin-panels/js/styling-21017.min.js?ver=2.10.17'></script> </body> </html>